Skip to content

Commit 0658e83

Browse files
committed
Preserve redirectUrl on taskUrl for after sign-in/sign-up
1 parent 36beaee commit 0658e83

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/clerk-js/src/core/clerk.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ import type {
2828
AuthenticateWithGoogleOneTapParams,
2929
AuthenticateWithMetamaskParams,
3030
AuthenticateWithOKXWalletParams,
31-
Clerk as ClerkInterface,
3231
ClerkAPIError,
3332
ClerkAuthenticateWithWeb3Params,
33+
Clerk as ClerkInterface,
3434
ClerkOptions,
3535
ClientJSONSnapshot,
3636
ClientResource,
@@ -1319,7 +1319,10 @@ export class Clerk implements ClerkInterface {
13191319
}
13201320

13211321
if (taskUrl) {
1322-
await this.navigate(taskUrl);
1322+
const taskUrlWithRedirect = redirectUrl
1323+
? buildURL({ base: taskUrl, hashSearchParams: { redirectUrl } }, { stringify: true })
1324+
: taskUrl;
1325+
await this.navigate(taskUrlWithRedirect);
13231326
return;
13241327
}
13251328

@@ -2350,8 +2353,8 @@ export class Clerk implements ClerkInterface {
23502353
this.#authService = await AuthCookieService.create(
23512354
this,
23522355
this.#fapiClient,
2353-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2354-
this.#instanceType!,
2356+
2357+
this.#instanceType,
23552358
this.#publicEventBus,
23562359
);
23572360

0 commit comments

Comments
 (0)