Skip to content

Comments

fix: stop excessive 401 polling on /users/profile when not logged in#512

Closed
livepeer-tessa wants to merge 1 commit intomainfrom
fix/issue-506
Closed

fix: stop excessive 401 polling on /users/profile when not logged in#512
livepeer-tessa wants to merge 1 commit intomainfrom
fix/issue-506

Conversation

@livepeer-tessa
Copy link

Problem

The web app continuously polls /users/profile even 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

  1. 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.

  2. Catch unhandled promise: Added a .catch() handler to the refreshUserProfile() call in DaydreamAccountSection so auth clearing on 401 is handled gracefully without unhandled promise rejections.

Fixes #506

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
@livepeer-tessa
Copy link
Author

Closing - wrong codebase. The 401 polling issue was on the web platform, not desktop app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web Platform: Excessive 401 polling on /users/profile when not logged in

1 participant