0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00

fix(router-utils, router-generator): what the coverage review of this lane's fixes found

Five reviewers over the lane's diff (bundle-size skill, coverage step); each
fix has a test that failed first.

Regressions of the lane:
- An array literal's element a planner rewrites at exactly its range (a
  server-only fn, a hoisted server fn) failed the compile ("both rewrite") or
  emptied the hoist: an edit or claim on exactly the element stays.
- `[createServerFn()… as any, 'T']`: `topLevelWithin` stopped at an erasure
  starting where the claim does, so the hoist lost its edits and the server fn
  returned undefined.
- A dropped literal value that writes (`{ a: ++n, b: n }`, `reg.push(1)`,
  `window.x = 1`) changed what kept code reads: it stays. Calls' unknown
  effects still go, as for a plain declarator (J4.12).
- A literal with `__proto__` (a getter of the prototype reads `this`) is left.
- `export default` above an overload signature or an interface lost the
  function's extraction (`declarations[0]`).
- Generator: a failed non-structural build batch lost the route change it read
  (`stale` was set only after the check).

Incomplete fixes completed:
- A server fn nested in another one inside a deleted option: a hidden claim
  inside a hidden claim is live (its placeholder's reads count).
- `snapshotDiffers` reads every declaration: a later `var` above which another
  `var` or a type declared the binding.
- An orphaned object rest element's literal values go with it.

Also: the `sameRange` guards under a hidden claim guarded nothing observable
(a test with and without them pins it): removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sheraff 2026-10-30 18:30:43 +01:00
commit e3a8dc5cfe
No known key found for this signature in database
12 changed files with 672 additions and 67 deletions