A lightweight design agent built with libfx. Describe a page and an agent writes it as one HTML file.
TypeScript
Keep sign-in open after a failed sign-out
Esteban Suarez0c3b1b5a7fa2
diff --git a/components/account-menu.tsx b/components/account-menu.tsxindex 0a3a65a..3903c4d 100644--- a/components/account-menu.tsx+++ b/components/account-menu.tsx@@ -78,7 +78,7 @@ export default function AccountMenu({ user, team = null, onSignOut, signOutStatuconst rowClass = sidebar ? 'h-8 w-full max-w-none justify-start px-3 text-[13px] text-foreground-secondary hover:text-foreground focus-visible:ring-offset-sidebar' : 'max-w-32'const signIn = (className = '') => (- <Button variant="ghost" size="sm" disabled={signOutStatus != null} className={`${sidebar ? rowClass : 'shrink-0'} ${className}`} {...fastClick(onSignIn)}>+ <Button variant="ghost" size="sm" disabled={signOutStatus === 'pending'} className={`${sidebar ? rowClass : 'shrink-0'} ${className}`} {...fastClick(onSignIn)}>Sign in</Button>)diff --git a/components/chat-app.tsx b/components/chat-app.tsxindex c34a0e9..d8f1d33 100644--- a/components/chat-app.tsx+++ b/components/chat-app.tsx@@ -334,7 +334,13 @@ export default function ChatApp({ account, sidebar, boot, preference, defaultModconst accountUser = user === undefined ? undefined : isAuthenticated ? user : nullfunction openSignIn() {- if (signedOut.current) return+ // After a failed sign-out the old grant is unusable (the pending marker hides it)+ // and retrying may keep failing. A fresh sign-in is the way out: the callback+ // clears the marker and issues a new login id.+ if (signedOut.current) {+ if (signOutStatus === 'failed') window.location.assign('/api/auth/signin')+ return+ }signInSends.current = falsesetDraftError('')setSignInOpen(true)diff --git a/tests/guest-ui.test.mjs b/tests/guest-ui.test.mjsindex e44ca91..f886453 100644--- a/tests/guest-ui.test.mjs+++ b/tests/guest-ui.test.mjs@@ -1088,6 +1088,13 @@ test('signout immediately clears the app, fences late boot data and offers retryconst retryButton = find(app.tree(), node => node.props?.children === 'Retry sign out')assert.ok(retryButton)assert.deepEqual(navigations, [])+ // The old grant is unusable and retrying may keep failing; a fresh sign-in must stay open.+ const failedMenu = controls.render(accountProps())+ const signInAfterFailure = find(failedMenu, node => node.props?.children === 'Sign in')+ assert.equal(signInAfterFailure.props.disabled, false)+ signInAfterFailure.props.onClick({ detail: 0 })+ assert.deepEqual(navigations, ['/api/auth/signin'])+ navigations.length = 0retry = true// A reload remounts the guest app while the old HttpOnly grant may still// exist. The durable intent resumes the POST without another user click.