Repository navigation
fix(router): replay stale PPR shells during navigation - #775
Merged
Merged
Conversation
…-replay # Conflicts: # packages/rangojs-router/docs/internal/execution-model.md # packages/rangojs-router/docs/internal/feature-map.md # packages/rangojs-router/docs/testing.md # packages/rangojs-router/e2e/shell-cache.test.ts # packages/rangojs-router/skills/ppr/SKILL.md # packages/rangojs-router/src/rsc/rsc-rendering.ts # packages/rangojs-router/src/testing/__tests__/shell-status.test.ts # packages/rangojs-router/src/testing/e2e/index.ts # packages/rangojs-router/src/testing/index.ts # packages/rangojs-router/src/testing/shell-status.ts # tests/cloudflare-basic/e2e/ppr-shell.test.ts
commit: |
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A consumer can declare a PPR route whose handler creates delayed component data and top-level handle promises, including an async
Metavalue derived from the same promise. During the SWR window, document requests served that captured shell asx-rango-shell: HIT, but partial navigation rejected the same snapshot and reran the handler. Consumers saw the full handler and Meta latency again and could receive values different from the shell generation that the document path advertised as a hit.Before vs. after
Before, this route needed an unrelated explicit data cache to avoid rerunning baked work during stale partial navigation:
After, the route declaration stays unchanged:
No migration or consumer opt-in is required.
End-to-end example
The e2e fixtures warm
/1, navigate/2 -> /1 -> /2, age/1into SWR, perform a stale document HIT that starts background recapture, and immediately navigate partially/2 -> /1. They assert that the component promise, both top-level handles, and async Meta title remain from the captured generation without waiting for the handler delay.Semantics
HIT; freshness=freshHIT; freshness=staleBYPASS; reason=no-entryx-rango-shell: HITCode changes
claimRevalidation: falsestore read.x-rango-ppr-replayandppr:navigation-replaytelemetry.@rangojs/router/testingand@rangojs/router/testing/e2e.Test plan
stale SWR navigation replays the captured handler promise, top-level handles, and Metafail on all three attempts: expectedHIT; freshness=stale, receivedBYPASS; reason=no-entry.e2e/mini: 4 focused tests passed.pnpm run typecheckpnpm run test:unit:allpnpm run lintpnpm run formatNotes
Partial navigation remains unable to capture HTML or own SWR regeneration. A later document request retains responsibility for background recapture. Build-manifest entries past their build TTL remain a bounded bypass because passive runtime SWR authorization is not available for that source.
Closes #773