fix: site title reverts to 'DM Alerts' after Discord OAuth redirect#111
Merged
Conversation
App.ngOnInit() calls settingsService.loadOnce() before the OAuth callback stores the JWT token, so GET /api/settings returns 401 and settings (including custom_title) are never loaded. The title stays as the default "DM Alerts" for the entire session. Fix: call loadOnce() in handleTokenFromCallback() after the token is stored and the user is loaded. Since the initial loadOnce() failed (loaded flag stayed false), this retry succeeds with the valid token. Closes #106
Contributor
Author
Code Review: PR #111Verdict: APPROVED ✓ SummaryFixes the site title reverting to "DM Alerts" after Discord OAuth redirect by calling Root CauseRace condition:
Note
No issues found. |
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.
Summary
Root cause
App.ngOnInit()callssettingsService.loadOnce()during bootstrap, but on the OAuth callback page, this fires beforeCallbackComponentextracts the JWT from the URL fragment and stores it in localStorage. TheGET /api/settingsrequest goes out without a Bearer token, gets a 401, and the error is silently swallowed. Sinceloadedstaysfalsebut nobody callsloadOnce()again, settings (includingcustom_title) are never loaded for the session.Fix
Call
settingsService.loadOnce()inhandleTokenFromCallback()after the token is stored and user is loaded. The retry succeeds because the token is now in localStorage for the auth interceptor.Closes #106
Test plan