Repository navigation
fix(user): stop UserSync forcing an upstream bootstrap - #945
Draft
thostetler wants to merge 3 commits into
Draft
thostetler wants to merge 3 commits into
thostetler wants to merge 3 commits into
Conversation
UserSync sent X-Refresh-Token on every client fetch of /api/user, which middleware treats as forced session invalidation, so it bootstrapped upstream even when the session was fresh. api.ts already owns expired-token recovery through its plain -> forced -> bootstrap fallback. Also corrects the ['user'] cache shape: ssr-utils and useUser write raw user data, but UserSync read data.user off an envelope, so its store-sync effect silently no-opped whenever the server seeded a valid token.
Api.invalidateUserData clears the store user to null on a 401 but leaves the ['user'] cache entry in place. With the cache shape corrected, UserSync's sync effect saw a valid-looking cached token beside a cleared store user and wrote the rejected one back. null is only ever written by that 401 path, so the effect now treats it as a signal to stand down. Also drops access_token from the sync debug log.
Bundle sizeShared by all pages: 629.6 kB (+0.0 kB) ⚪ No route changed by more than 1 kB. ✅ First load = polyfills + shared |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #945 +/- ##
========================================
+ Coverage 55.0% 55.1% +0.1%
========================================
Files 374 375 +1
Lines 11462 11478 +16
Branches 2514 2517 +3
========================================
+ Hits 6303 6320 +17
+ Misses 4527 4526 -1
Partials 632 632
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
UserSync sent a forced-refresh header on every client fetch of /api/user, so middleware discarded the session it had just minted for that page and made an upstream round trip to rebuild it. Expired sessions still recover through the api layer's forced refresh.