Skip to content

Commit b30f9ad

Browse files
committed
Guard passkey autofill effect on unmount
1 parent de676e0 commit b30f9ad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/routes/login.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ function Login({ loaderData: data }: Route.ComponentProps) {
222222
const json = await optionsResponse.json()
223223
const { options } = AuthenticationOptionsSchema.parse(json)
224224

225+
if (!isMounted) return
226+
225227
const authResponse = await startAuthentication({
226228
optionsJSON: options,
227229
useBrowserAutofill: true,
@@ -244,6 +246,8 @@ function Login({ loaderData: data }: Route.ComponentProps) {
244246
| { status: 'success' }
245247
| { status: 'error'; error: string }
246248

249+
if (!isMounted) return
250+
247251
if (verificationJson.status === 'error') {
248252
throw new Error(verificationJson.error)
249253
}

0 commit comments

Comments
 (0)