test(ppr): cover streaming actions across replay modes - #790
Merged
Conversation
commit: |
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
Cached content has two distinct Server Action paths. Runtime-captured PPR shells must preserve inline closure-bound action references across document HIT hydration and partial replay. Build-time
Passthrough(Prerender(...), liveHandler) + pprcontent can stream a client-imported module action only while the prerendered client boundary is retained; default Passthrough action revalidation replaces that boundary with the live handler and drops its localuseActionStateresult.The existing coverage did not pin these boundaries end to end. A regression could lose an encrypted inline closure, leave a streamed result behind its Suspense fallback, duplicate a resumed subtree, or reload the document while a basic invocation assertion still passed.
Before vs. after
No consumer migration or public API change is required.
Before, this usage had only basic action invocation coverage:
After, pending-to-streamed-result behavior is verified in development and production for:
End-to-end example
A runtime PPR action can retain render-scope data while its result streams independently from another PPR hole:
For build-time Prerender content, use a module-level action and retain the prerendered boundary when its local action state must stream:
Semantics
x-rango-ppr-replay: HIT; action fallback and result resolve without suppressing the independent holeBYPASS; reason=prerender-store; ordinary navigation revalidation remains unchangeduseActionStateresultuseActionStateexposes pending, streamed fallback, resolved result, restored idle state, and concurrent submissionsCode changes
disabled={isPending}.modeand moved shell hydration waiting intotests/shared-e2ewith the pending-document-stream rationale.test.actions.tsxaction module.Test plan
pnpm --filter @rangojs/router exec playwright test semantic-matrix: 75 passedpnpm run typecheckpnpm run test:unit:allpnpm run lintpnpm run formatpnpm check:e2e-bucketingpnpm check:e2e-parity --strictThe browser suites exercise the public route DSL,
useActionState, Server Action props, PPR replay, and Prerender behavior as consumer applications do.Notes
Static/PrerenderFlight remain unsupported until decoded server references can be preserved across storage and replay (fix(router): preserve embedded server actions across cache and prerender hits #584 / feat(rsc): improve directive transform primitives vitejs/vite-plugin-react#1246).