-
Notifications
You must be signed in to change notification settings - Fork 407
chore(clerk-js): Remove sessions instead of destroying the client #3941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
266835f
chore(clerk-js): Remove sessions instead of destroying the client
panteliselef 555fc50
Add changeset
panteliselef 38ecb2b
use the new fapi endpoint
panteliselef 3c1fab8
update changeset
panteliselef 18c6df8
add experimental options in ClerkOptions
panteliselef 45bd03d
update e2e tests
panteliselef d4e469f
update changeset
panteliselef 3d7f2ac
Merge branch 'refs/heads/main' into elef/stop-destroying-the-client
panteliselef 03eca38
Apply suggestions from code review
panteliselef 28cf3ce
Update .changeset/funny-monkeys-brush.md
panteliselef e3ab798
Update integration/tests/sign-out-smoke.test.ts
panteliselef 7e336f1
Merge branch 'main' into elef/stop-destroying-the-client
panteliselef 416d3e0
Merge branch 'main' into elef/stop-destroying-the-client
panteliselef 7555403
Merge branch 'main' into elef/stop-destroying-the-client
panteliselef 1851fe9
Merge branch 'main' into elef/stop-destroying-the-client
panteliselef d3c2f87
Update .changeset/funny-monkeys-brush.md
panteliselef File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| --- | ||
| "@clerk/types": minor | ||
| "@clerk/clerk-js": minor | ||
| --- | ||
|
|
||
| **Experimental:** Persist the Clerk client after signing out a user. | ||
| This allows for matching a user's device with a client. To try out this new feature, enable it in your `<ClerkProvider />` or `clerk.load()` call. | ||
|
|
||
| ```js | ||
| // React | ||
| <ClerkProvider experimental={{ persistClient: true }} /> | ||
|
|
||
| // Vanilla JS | ||
| await clerk.load({ experimental: { persistClient: true } }) | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
integration/templates/next-app-router/src/app/client-id.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| 'use client'; | ||
| import { useClerk, useSession } from '@clerk/nextjs'; | ||
| import React from 'react'; | ||
|
|
||
| export function ClientId() { | ||
| const clerk = useClerk(); | ||
| // For re-rendering | ||
| useSession(); | ||
| return ( | ||
| <> | ||
| {clerk?.client?.id && <p data-clerk-id>{clerk?.client?.id}</p>} | ||
| {clerk?.client?.lastActiveSessionId && <p data-clerk-session>{clerk?.client?.lastActiveSessionId}</p>} | ||
| </> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { useClerk, useSession } from '@clerk/clerk-react'; | ||
| import React from 'react'; | ||
|
|
||
| export function ClientId() { | ||
| const clerk = useClerk(); | ||
| // For re-rendering | ||
| useSession(); | ||
| return ( | ||
| <> | ||
| {clerk?.client?.id && <p data-clerk-id>{clerk?.client?.id}</p>} | ||
| {clerk?.client?.lastActiveSessionId && <p data-clerk-session>{clerk?.client?.lastActiveSessionId}</p>} | ||
| </> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice tests 👏