fix: stop excessive 401 polling on /users/profile when not logged in#512
Closed
livepeer-tessa wants to merge 1 commit intomainfrom
Closed
fix: stop excessive 401 polling on /users/profile when not logged in#512livepeer-tessa wants to merge 1 commit intomainfrom
livepeer-tessa wants to merge 1 commit intomainfrom
Conversation
When fetchUserProfile receives a 401 response, clear stored auth data to prevent repeated failed requests. Also adds a catch handler for the refreshUserProfile call in DaydreamAccountSection to handle the cleared auth state gracefully. Fixes #506
Author
|
Closing - wrong codebase. The 401 polling issue was on the web platform, not desktop app. |
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
The web app continuously polls
/users/profileeven when the user is not logged in, flooding the browser console with 401 errors (see #506).Root Cause
When
fetchUserProfile()receives a 401 response, it throws a generic error but doesn't clear the stored auth data. This means the app retains stale/invalid credentials and keeps retrying the API call on subsequent component mounts or navigations.Fix
Clear auth on 401: When
fetchUserProfile()gets a 401 response, immediately clear stored auth data from localStorage and dispatch the auth-change event. This prevents any further authenticated API calls with invalid credentials.Catch unhandled promise: Added a
.catch()handler to therefreshUserProfile()call inDaydreamAccountSectionso auth clearing on 401 is handled gracefully without unhandled promise rejections.Fixes #506