-
Notifications
You must be signed in to change notification settings - Fork 371
feat(clerk-js): Introduce navigate
for setActive
#6486
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
Open
LauraBeatris
wants to merge
42
commits into
main
Choose a base branch
from
laura/introduce-on-pending-session
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
9f8e387
Remove `__internal_navigateToTaskIfAvailable`
LauraBeatris 63cb97c
Introduce `onPendingSession` and remove `#componentNavigationContext`
LauraBeatris d2b6b9a
Remove redirect to task within `withRedirect` guard
LauraBeatris 21730cb
Navigate to tasks from sign up context
LauraBeatris 4511ee1
Remove `NavigateToTask` control component
LauraBeatris 4e8ac6f
Add redirect guards for root sign-in / sign-up AIOs
LauraBeatris 12d5b13
Use `taskUrl` from AIOs navigation
LauraBeatris 09181df
Validate task options on Clerk init
LauraBeatris 9c15f8c
Adjust unit tests with newest API
LauraBeatris 8e8cc86
Remove `#handlePendingSession` branch and introduce `navigate` option
nikosdouvlis 73cb09b
Replace `onPendingSession` with `navigate`
LauraBeatris 1d5cdc9
Add unit tests for invalidation hooks
LauraBeatris daf0f06
Fix display name of redirect guards
LauraBeatris bc36a29
Rename `navigateToTask` from `navigateIfTaskExists`
LauraBeatris da36727
Add warning for missing params for task handling
LauraBeatris cb3981f
Fix navigation between sign-in/sign-up steps
LauraBeatris 0d99f7e
Preserve `redirectUrl` on `taskUrl` for after sign-in/sign-up
LauraBeatris ef2df25
Add changesets
LauraBeatris 78a7258
Navigate to next task if any from AIOs
LauraBeatris 69593ad
Fix `warnMissingPendingTaskHandlers` call
LauraBeatris 695000d
Add `@inline` to `SetActiveNavigate` type
LauraBeatris 3a2a345
Fix navigation on active sessions
LauraBeatris 09c40ae
Fix mocking of `signedInSessions`
LauraBeatris 87d59c2
Update custom flow snippet from changeset
LauraBeatris eee514b
Fix typedoc tests
LauraBeatris aad5654
Fix navigation for multi-session
LauraBeatris 073b648
Use `navigate` for `setActive` on combined flow
LauraBeatris a46e00e
Rename `RedirectToTask` control component to `RedirectToTasks`
LauraBeatris 6c298ac
Fix E2E test for sign-up with tasks
LauraBeatris 8077716
Display root sign-in for multi-session mode with tasks
LauraBeatris 738c9f0
Fix navigating to tasks on SSO callback
LauraBeatris b031996
Bump max size of `clerk.headless` bundle
LauraBeatris bbe73ad
Remove condition to always send `redirect_url` for SSO with after-aut…
LauraBeatris fea15d0
Remove duplicated changeset
LauraBeatris f570e5e
Remove `SessionTasksContext` from `TaskChooseOrganization`
LauraBeatris 01b9740
Fix `redirectUrl` for SSO with SignIn
LauraBeatris 750c266
Run `onAfterSetActive` if the new session is `active`
LauraBeatris fc642c3
Always use the latest session for status checks
nikosdouvlis 80e50a9
Fix early returns in setActive
nikosdouvlis f3a3ad2
Fix session status check within `setActive`
LauraBeatris ff831cc
Maintain base URL of sign-in/sign-up for routing
LauraBeatris 16b3b5f
Fix navigation for SSO to maintain path and hash routing
LauraBeatris 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,23 @@ | ||
--- | ||
'@clerk/clerk-js': minor | ||
'@clerk/types': minor | ||
--- | ||
|
||
Add `navigate` parameter to `clerk.setActive()` for custom navigation before the session and/or organization is set. | ||
|
||
It's useful for handling pending session tasks for after-auth flows: | ||
|
||
```typescript | ||
await clerk.setActive({ | ||
session, | ||
navigate: async ({ session }) => { | ||
const currentTask = session.currentTask; | ||
if (currentTask) { | ||
await router.push(`/onboarding/${currentTask.key}`) | ||
return; | ||
} | ||
|
||
await navigate('/dashboard') | ||
} | ||
}); | ||
``` |
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,11 @@ | ||
--- | ||
'@clerk/tanstack-react-start': minor | ||
'@clerk/react-router': minor | ||
'@clerk/nextjs': minor | ||
'@clerk/clerk-react': minor | ||
'@clerk/remix': minor | ||
'@clerk/types': minor | ||
'@clerk/vue': minor | ||
--- | ||
|
||
Rename `RedirectToTask` control component to `RedirectToTasks` |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.