Don't let a failed settings fetch block auth restore on reload - #6
Open
JustSamuel wants to merge 1 commit into
Open
Don't let a failed settings fetch block auth restore on reload#6JustSamuel wants to merge 1 commit into
JustSamuel wants to merge 1 commit into
Conversation
beforeLoad() returned early if settingsStore.fetchKeys() threw, which skipped populateStoresFromToken() for the rest of that page load. On any fresh page load (hard reload or deep link) that meant a logged-in user's auth store never got repopulated from their stored JWT, so the router guard treated them as unauthenticated and sent them back to login even with a valid token. Locally this fires on every hard reload once STRIPE_PUBLIC_KEY is unset, since /v1/stripe/public then 401s, but the same early return would fire in production too if that settings fetch ever failed for an unrelated reason. Catch the fetchKeys() failure inline instead of returning early, so populateStoresFromToken() and the terms-of-service fetch always run regardless of whether the settings fetch succeeded. setupWebSocket() gets its own try/catch for the same reason. Fixes #852
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the dashboard’s startup beforeLoad sequence so that a failure while fetching public settings keys no longer prevents authentication restoration when the app is reloaded. This aligns the dashboard’s behavior with the ported change from the upstream frontend repository.
Changes:
- Decouples
settingsStore.fetchKeys()error handling from the WebSocket setup block so settings failures no longer short-circuit initialization. - Ensures
populateStoresFromToken(apiService)still runs even if fetching settings keys fails, allowing auth restoration to proceed on reload.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
RubenLWF
approved these changes
Aug 30, 2026
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.
Ported from GEWIS/sudosos-frontend#853.
No changes needed during the port beyond the directory prefix (
frontend/) -- patch applied cleanly viagit am, andfrontend:build/frontend:lintboth pass.