Skip to content

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

fix(studio): fallback to initial when OAuth logo fails to load (#46953)

Danny White3211d52a2a81
diff --git a/apps/studio/components/interfaces/Organization/OAuthApps/AuthorizeRequesterDetails.tsx b/apps/studio/components/interfaces/Organization/OAuthApps/AuthorizeRequesterDetails.tsx
index 9d5aad764c8..f4412261806 100644
--- a/apps/studio/components/interfaces/Organization/OAuthApps/AuthorizeRequesterDetails.tsx
+++ b/apps/studio/components/interfaces/Organization/OAuthApps/AuthorizeRequesterDetails.tsx
@@ -165,15 +165,25 @@ const PERMISSION_GROUPS: PermissionGroup[] = [
},
]
-export const RequesterLogo = ({ icon, name }: { icon: string | null; name: string }) => (
- <LogoBox>
- {icon ? (
- <img alt={name} src={icon} className="size-full object-cover" />
- ) : (
- <span className="text-lg font-medium text-foreground-light">{name.slice(0, 1)}</span>
- )}
- </LogoBox>
-)
+export const RequesterLogo = ({ icon, name }: { icon: string | null; name: string }) => {
+ const [failedIcon, setFailedIcon] = useState<string | null>(null)
+ const showLetter = !icon || failedIcon === icon
+
+ return (
+ <LogoBox>
+ {showLetter ? (
+ <span className="text-lg font-medium text-foreground-light">{name.slice(0, 1)}</span>
+ ) : (
+ <img
+ alt={name}
+ src={icon}
+ className="size-full object-cover"
+ onError={() => setFailedIcon(icon)}
+ />
+ )}
+ </LogoBox>
+ )
+}
export const AuthorizeRequesterDetails = ({
name,