mirror of
https://github.com/outline/outline.git
synced 2026-11-26 23:50:14 +03:00
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:
1 parent
deadaa00f1
commit
d2a0bf9923
1 file changed
+2
-2
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user