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

fix(router-utils): a claim other generated code reads outlives an erasure of its occurrence

Start SSR with `router.codeSplittingOptions.deleteNodes: ['loader']` and a
server fn defined inside the loader: the client keeps the loader and calls
the server fn, but the server's RPC wrapper called `tsrServerFn$greet`, a
hoist the core had dropped (500, ReferenceError). The core killed every
claim whose occurrence a planner erased, owner included; the provider's
hoisted chain is a declaration its wrapper reads, as a top-level server fn
read only by the deleted loader stays (that case already worked). Main
never compiled a nested server fn (its handler shipped to the client).

A claim whose owner other generated code reads (another unit, another
claim's placeholder) is now always in the render tree: an erasure of its
occurrence removes only the placeholder there (`placeholderRenders` asks
whether the claim edit renders), and the owner stays while placement
reaches it. Liveness inside any claim is decided by the edits inside the
region (it renders inside its owner), unless an edit on exactly the region
replaces the placeholder in that output; `erasedParts` carves such a claim
out of an enclosing erased part. Other claims die with their occurrence,
as before (their owner is only reached through it).

TSR_COMPILER_VERIFY's unbound-read check (g) also covers generated names:
it now fails the compile of the old output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sheraff 2026-10-30 15:46:15 +01:00
commit 7f69ca9a87
No known key found for this signature in database
6 changed files with 320 additions and 51 deletions