From d2a0bf99238302e8063385c8bc5f329bec6db338 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 28 May 2026 09:06:58 -0400 Subject: [PATCH] fix: Avoid team invariant violation on OAuth authorize error (#12506) When /oauthClients.info returns an AuthorizationError, ApiClient logs the user out and clears auth.team. The subsequent re-render of the Authorize component hit the strict useCurrentTeam() and threw before the error UI could render. Make the inner hook tolerate a missing team and fold it into the existing error branch. Co-authored-by: Claude Opus 4.7 --- app/scenes/Login/OAuthAuthorize.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scenes/Login/OAuthAuthorize.tsx b/app/scenes/Login/OAuthAuthorize.tsx index d916f9a923..07556aaab6 100644 --- a/app/scenes/Login/OAuthAuthorize.tsx +++ b/app/scenes/Login/OAuthAuthorize.tsx @@ -76,7 +76,7 @@ function inputScopes(scope?: string): string[] { * and allows the user to either authorize or cancel the request. */ function Authorize() { - const team = useCurrentTeam(); + const team = useCurrentTeam({ rejectOnEmpty: false }); const params = useQuery(); const { t } = useTranslation(); const [isSubmitting, setIsSubmitting] = useState(false); @@ -133,7 +133,7 @@ function Authorize() { !state && "state", ].filter(Boolean); - if (missingParams.length || clientError) { + if (missingParams.length || clientError || !team) { return (