Repository navigation
Conversation
…nses The clientVersion check added with the stale-client reload feature covers lazy route discovery and the router data strategy, but server functions invoked through createCallServer apply their rerender payload without a version check — a stale client patches new-build route manifests and loaderData into old-build modules. Store the hydration baseline alongside the other router globals (the callServer callback is constructed via setServerCallback before createRouterFromPayload runs, so it cannot close over the payload) and run handleClientVersionMismatch before the action-supersede guard: skew is a whole-client condition, so a superseded action must still reload a stale document. Redirect rerenders carry no version and stay unchanged — they either hard-reload or re-enter the data strategy, which already checks. skipRevalidation actions carry no rerender payload to check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
I found one issue with the reload path. If a server function returns a rerender from a different build while the current URL is I pushed a fix in Authored by an AI agent on behalf of @brophdawg11 |
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.
The
clientVersionstale-client detection shipped in #15318 covers lazy route discovery (?version=→ 204 +X-Remix-Reload-Document) and the router data strategy (loaders and router-driven actions comparepayload.clientVersion). Server functions invoked throughunstable_createCallServer— client-component form actions /useActionState/ imperative calls viasetServerCallback— are the one payload-applying path with no check: the action's rerender is applied unconditionally, so a stale client patches new-build route manifests andloaderDatainto old-build modules viapatchRoutes+_internalSetState…. That's precisely the mismatched-module state the feature exists to prevent, on what is many apps' highest-write-traffic boundary.The rerender does carry the version:
baseRenderPayloadincludesclientVersionand feeds the action payload'srerender(the top-level action payload deliberately has no version field — the check must readrerender.clientVersion).Change
__reactRouterClientVersion).createCallServeris constructed viasetServerCallbackbeforecreateRouterFromPayloadruns, so it cannot close over the payload; timing is safe because no action can fire before hydration populates the global. When the feature is unwired, both sides areundefinedand behavior is unchanged.handleClientVersionMismatchbefore the action-supersede guard: skew is a whole-client condition, so a superseded action must still reload a stale document. On mismatch the stale rerender is never applied and the caller's already-resolvedactionResultis unaffected (the mutation landed server-side). The existing sessionStorage loop guard applies unchanged.skipRevalidationactions carry no rerender payload to check.Tests
Added to
integration/rsc-client-version-test.tsin the file's existing pattern (route-intercept the action POST, swap the version in the rerender stream): a stale server-function rerender now reloads the destination document instead of applying. Verified red onmain(test fails without the fix) and green with it; the file's four existing tests still pass.One observation from working in this code, left out of scope:
landedActionIdincreateCallServeris declared and read in the supersede guard but never assigned anywhere — half of that guard is dead. Happy to file separately if useful.🤖 Generated with Claude Code on behalf of agcty