From 50a6ebbe6dec7f5a528fd29fc366d874a6f778d3 Mon Sep 17 00:00:00 2001
From: Gildas Garcia <1122076+djhi@users.noreply.github.com>
Date: Fri, 4 Sep 2026 17:18:40 +0200
Subject: [PATCH] Scoped PAT: improve error handling when showing a token
details (#49997)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We already have proper error handling on:
- the token list query
- token creation/deletion with toasts
We had custom error handling on the token permissions sheet. Replaced it
with an `AlertError`:
Question: should we do something about the sheet header when the token
couldn't be loaded?
## Summary by CodeRabbit
* **Bug Fixes**
* Improved the access token loading error state with a clearer,
consistent error display and “Please try again” guidance.
* Added a fallback label of “Unknown” when an access token name is
unavailable.
---
.../Account/AccessTokens/Scoped/ViewTokenSheet.tsx | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/ViewTokenSheet.tsx b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/ViewTokenSheet.tsx
index 7ac97feadf3..5a0b45bbdc1 100644
--- a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/ViewTokenSheet.tsx
+++ b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/ViewTokenSheet.tsx
@@ -22,6 +22,7 @@ import {
type CapabilityLevelFilter,
} from './TokenCapabilities/TokenCapabilities.utils'
import { TokenDocsButtons } from './TokenDocsButtons'
+import { AlertError } from '@/components/ui/AlertError'
import { useOrganizationsQuery } from '@/data/organizations/organizations-query'
import { useProjectsInfiniteQuery } from '@/data/projects/projects-infinite-query'
import {
@@ -144,8 +145,8 @@ export function ViewTokenSheet({ visible, tokenId, onClose }: ViewTokenSheetProp
'flex flex-col md:flex-row justify-between gap-4 items-start md:items-center border-b'
)}
>
-
- View access for {token?.name} +
+ View access for {token?.name ?? 'Unknown'}
- Error loading token information. Please try again. -
-