Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix jwt infinitely loading (#35848)

Terry Sutton075bc01a351a
diff --git a/apps/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx b/apps/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx
index e6e370f7931..e9f05f5cd25 100644
--- a/apps/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx
+++ b/apps/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx
@@ -56,8 +56,15 @@ const APIKeys = () => {
isLoading: isJwtSecretUpdateStatusLoading,
} = useJwtSecretUpdatingStatusQuery(
{ projectRef },
- { enabled: !isProjectSettingsLoading && isApiKeysEmpty }
+ {
+ enabled: !isProjectSettingsLoading && isApiKeysEmpty,
+ }
)
+
+ // Only show JWT loading state if the query is actually enabled
+ const showJwtLoading =
+ isJwtSecretUpdateStatusLoading && !isProjectSettingsLoading && isApiKeysEmpty
+
const jwtSecretUpdateStatus = data?.jwtSecretUpdateStatus
const canReadAPIKeys = useCheckPermissions(PermissionAction.READ, 'service_api_keys')
@@ -93,14 +100,20 @@ const APIKeys = () => {
{isProjectSettingsError ? 'Failed to retrieve API keys' : 'Failed to update JWT secret'}
</p>
</div>
- ) : isApiKeysEmpty || isProjectSettingsLoading || isJwtSecretUpdateStatusLoading ? (
+ ) : isProjectSettingsLoading ? (
<div className="flex items-center justify-center py-8 space-x-2">
<Loader className="animate-spin" size={16} strokeWidth={1.5} />
- <p className="text-sm text-foreground-light">
- {isProjectSettingsLoading || isApiKeysEmpty
- ? 'Retrieving API keys'
- : 'JWT secret is being updated'}
- </p>
+ <p className="text-sm text-foreground-light">Retrieving API keys</p>
+ </div>
+ ) : isApiKeysEmpty ? (
+ <div className="flex items-center justify-center py-8 space-x-2">
+ <Loader className="animate-spin" size={16} strokeWidth={1.5} />
+ <p className="text-sm text-foreground-light">Retrieving API keys</p>
+ </div>
+ ) : showJwtLoading ? (
+ <div className="flex items-center justify-center py-8 space-x-2">
+ <Loader className="animate-spin" size={16} strokeWidth={1.5} />
+ <p className="text-sm text-foreground-light">JWT secret is being updated</p>
</div>
) : (
<>