Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(web): show an error state when CLI API keys fail to load
Richie McIlroyb6ca96e4e42e
diff --git a/apps/web/app/(org)/dashboard/settings/account/components/CliApiKeys.tsx b/apps/web/app/(org)/dashboard/settings/account/components/CliApiKeys.tsxindex 0749209d2..655383eb6 100644--- a/apps/web/app/(org)/dashboard/settings/account/components/CliApiKeys.tsx+++ b/apps/web/app/(org)/dashboard/settings/account/components/CliApiKeys.tsx@@ -56,8 +56,10 @@ const formatDate = (iso: string) =>export const CliApiKeys = ({initialKeys,+ loadFailed = false,}: {initialKeys: CliApiKeySummary[];+ loadFailed?: boolean;}) => {const router = useRouter();const [keys, setKeys] = useState(initialKeys);@@ -126,6 +128,12 @@ export const CliApiKeys = ({Create API key</Button></div>+ {loadFailed && (+ <div className="rounded-xl border border-red-4 bg-red-2 px-4 py-3 text-sm text-red-11">+ Your API keys could not be loaded. Refresh the page to try again.+ Existing keys are still active and can be revoked once the list loads.+ </div>+ )}{keys.length > 0 && (<div className="flex flex-col divide-y divide-gray-3 rounded-xl border border-gray-4">{keys.map((key) => {diff --git a/apps/web/app/(org)/dashboard/settings/account/page.tsx b/apps/web/app/(org)/dashboard/settings/account/page.tsxindex ffb245b2b..e674a6049 100644--- a/apps/web/app/(org)/dashboard/settings/account/page.tsx+++ b/apps/web/app/(org)/dashboard/settings/account/page.tsx@@ -8,13 +8,16 @@ export const metadata: Metadata = {};export default async function SettingsPage() {- // The key list is an enhancement to the settings page, not a dependency: if the session is- // mid-redirect or the query hiccups, render the page with an empty list instead of a 500.- const cliApiKeys = await listCliApiKeys().catch(() => []);+ // A failed key query must not 500 the whole settings page, but it also must not render as+ // an empty list, which would hide still-active keys the user may need to revoke.+ const cliApiKeys = await listCliApiKeys().catch(() => null);return (<><Settings />- <CliApiKeys initialKeys={cliApiKeys} />+ <CliApiKeys+ initialKeys={cliApiKeys ?? []}+ loadFailed={cliApiKeys === null}+ /></>);}