Skip to content

Commit c08f08a

Browse files
authored
fix(clerk-js): Only reload client if session is not present (#7103)
1 parent 62a7567 commit c08f08a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/strict-hornets-kneel.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,8 +1117,11 @@ class SignInFuture implements SignInFutureResource {
11171117
throw new Error('Cannot finalize sign-in without a created session.');
11181118
}
11191119

1120-
// Reload the client to prevent an issue where the created session is not picked up.
1121-
await SignIn.clerk.client?.reload();
1120+
// Reload the client if the created session is not in the client's sessions. This can happen during modal SSO
1121+
// flows where the in-memory client does not have the created session.
1122+
if (SignIn.clerk.client && !SignIn.clerk.client.sessions.some(s => s.id === this.resource.createdSessionId)) {
1123+
await SignIn.clerk.client.reload();
1124+
}
11221125

11231126
await SignIn.clerk.setActive({ session: this.resource.createdSessionId, navigate });
11241127
});

0 commit comments

Comments
 (0)