Add server-managed stale client handling with build IDs#1222
Draft
justinvdm wants to merge 7 commits into
Draft
Conversation
Deploying redwood-sdk-docs with
|
| Latest commit: |
730eae2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://09dadfb9.redwood-sdk-docs.pages.dev |
| Branch Preview URL: | https://stale-build-ids.redwood-sdk-docs.pages.dev |
… check Replace handleStaleResponse (check + act) with pure isStaleReloadResponse. Remove triggerStaleReload, clearStaleReloadGuard, and sessionStorage state. A stale reload is a full page load that always fetches fresh HTML and assets. The new client bundle has no stale state, so a guard is unnecessary.
Lift await fetchPromise before handleResponse branch so stale check runs once. Remove stale check from navigation.ts handleResponse; stale is handled upstream.
- Rename getStaleEvent → isStaleRequest (boolean predicate) - Add buildStaleEvent for custom policies that need event data - Rename withClientVersionQuery → addClientVersionToUrl - Remove dead withClientVersionQueryString wrapper - Extract createClientVersionHeaders for DRY header building - Add docs/architecture/staleClientHandling.md
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
Stale RedwoodSDK tabs keep talking to a newer deployment without any framework-managed version check. Core RSC requests continue to succeed when they should tell the client to reload, and synced state websocket sessions continue to open against a newer build.
Solution
We generate a RedwoodSDK build ID through the Vite plugin, expose it to the worker and client runtime, and use it as the shared stale version signal. Core requests now send their client build ID, synced state websocket URLs carry the same version, asset URLs include the build ID, and the server returns a reload response when an older client talks to a newer build. We also added permanent deploy-only playground coverage for the core stale request path and the synced state stale session path.
Verification
We ran the focused stale unit tests and both deploy-only playground stale tests in preview mode. All passed.