fix(dashboard): skip the sidebar org fetch when signed out - #445
Open
Rish-it wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the dashboard sidebar’s org-switcher useEffect to avoid issuing unauthenticated organization requests when the user transitions to a signed-out state.
Changes:
- Add a guard in the sidebar org-fetch effect to bail out when
user?.idis missing. - Document why the guard is needed (prevents post-logout unauthenticated org calls and resulting console noise).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // user id, which sign-out transitions to undefined — without the guard every | ||
| // logout fires two unauthenticated org calls whose failures are swallowed by | ||
| // the catch, leaving only console noise. | ||
| if (!user?.id) return; |
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
Guards the sidebar's org-list fetch effect so it doesn't fire when the user is signed out.
Motivation
The effect is keyed on the user id, which sign-out transitions to
undefined. Without a guard, every logout fires two unauthenticated org calls that 401 and get swallowed by the catch, leaving only console noise.Related issue
None
Changes
user?.idis missingVerification
Manual: signed out and confirmed no 401s fire from the sidebar org fetch on logout.
Checklist