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 <noreply@anthropic.com>
This commit is contained in:
Tom MoorandClaude Opus 4.7 authored and GitHub committed 2026-05-28 09:06:58 -04:00
1 parent deadaa00f1
commit d2a0bf9923
1 file changed
+2 -2
+2 -2
View File
@@ -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 (
<Background>
<Centered>