fix: clear stale external auth validation error after revalidation - #28881
Open
VihaanAgarwal wants to merge 1 commit into
Open
fix: clear stale external auth validation error after revalidation#28881VihaanAgarwal wants to merge 1 commit into
VihaanAgarwal wants to merge 1 commit into
Conversation
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.
Fixes #28876
On
/settings/external-auth, a row could show a disabledAuthenticatedbutton next toError: token failed to validate, and a "Test Validate" run would toastApplication link is valid.while the error text stayed until a hard reload.The badge and the error come from two react-query entries that were never resynced. The button reads the per-provider query, but
validate_erroronly exists on the list query, andvalidateExternalAuthonly wrote the per-provider cache key. Nothing except unlink ever invalidated the list, so an error captured at page load stuck around after a successful re-auth or validation.Two changes:
validateExternalAuth.onSuccessnow also invalidates the list query (exact key), so the refetched link reflects current state.Added tests covering both: one drives "Test Validate" from a failed state and asserts the list is refetched and the error clears, one pins that a stale list error never renders next to an
Authenticatedbutton. Both fail without the fix. Also setauthenticated: falseon theFailedstorybook story, since a failed-validation link is unauthenticated.Verification:
biome checkandtsc -p .clean; the existing device-flow test inpages/ExternalAuthPagestill passes.Written with AI assistance.