Skip to content

Commit e3728eb

Browse files
committed
fix: logout empty screen
1 parent faa5af0 commit e3728eb

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

packages/react-kit/src/auth/pages/Verifying.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ export function Verifying() {
3232
onSuccess: async () => {
3333
clearOtpSession()
3434
goToStep('authenticated')
35+
// Navigate the address bar off the magic-link landing URL so a
36+
// refresh doesn't re-trigger verification.
37+
if (typeof window !== 'undefined') {
38+
window.history.replaceState({}, '', '/')
39+
}
3540
config?.onSuccess?.()
3641
},
3742
onError: (err) => {

packages/react-kit/src/connector.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,10 @@ describe('connector', () => {
292292
// Disconnect
293293
await connector.disconnect?.()
294294

295-
// Auth should be reset and reinitialized
295+
// Auth should be reset and reinitialized, then surface the sign-up
296+
// page so the user can re-authenticate.
296297
expect(store.getState().auth.email).toBeNull()
297-
expect(store.getState().auth.step).toBe('initializing')
298+
expect(store.getState().auth.step).toBe('sign-up')
298299
expect(store.getState().auth.config).toEqual(authConfig)
299300
})
300301

packages/react-kit/src/connector.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,13 @@ export function zeroDevWallet(
8585

8686
async disconnect() {
8787
await connector.disconnect?.()
88-
// Reset auth state on disconnect
88+
// Reset auth state on disconnect and surface the sign-up page so the
89+
// user can immediately re-authenticate instead of seeing an empty
90+
// AuthFlow (the 'initializing' step renders null).
8991
if (params.config?.auth) {
9092
store.getState().auth.reset()
9193
store.getState().auth.initialize(params.config.auth)
94+
store.getState().auth.goToStep('sign-up')
9295
}
9396
},
9497

0 commit comments

Comments
 (0)