ta
TanStack
OSS
ta
Pipelines
Nx runs
Insights
Compare tasks
Analytics
Sign in
Toggle Sidebar
ro
router
Pipelines
fix(router-core): keep sparse arrays with extra keys opaque in replaceEqualDeep The plain-array check compares `Object.keys(array).length` with `array.length`. A hole and an extra enumerable key cancel out in that count, so `Object.assign([1, ,], { extra: 'x' })` was admitted: the index-based copy dropped `extra` and turned the hole into an explicit `undefined`, and an index-wise equal `prev` was returned for it. The same blind spot exists in the exported `isPlainArray`, which the previous implementation used for this check. Extra string keys always sort after the index keys, so once the count matches, `next` is a dense index-only array exactly when its last key is its last index. That is one string comparison per array instead of a per-key validation, and it stays inline with the existing count check. `prev` keeps the count check only: a result is either a copy built from `next`'s entries or `prev` itself, which the caller already holds. Symbol keys on arrays stay admitted, as before this stack: checking them costs an `Object.getOwnPropertySymbols` call per array pair, which measured ~8% on the equal nested search shape (a record holding a four-element array), and `react-router.minimal` +3 B on top of the +13 B gzip of this fix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
nx affected --targets=test:eslint,test:unit,test:e2e,test:types,test:build,build --parallel=3
⌘K
fix(router-core): keep sparse arrays with extra keys opaque in replaceEqualDeep
Succeeded
in
13m 29s
Started
Copy command
nx affected --targets=test:eslint,test:unit,test:e2e,test:types,test:build,build --parallel=3
8389
f667029
GitHub
Open on GitHub
Tasks
Resource Usage
ta
TanStack
OSS