-
Notifications
You must be signed in to change notification settings - Fork 374
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
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
ddff9e4
Remove `__internal_navigateToTaskIfAvailable`
LauraBeatris a4892f2
Introduce `onPendingSession` and remove `#componentNavigationContext`
LauraBeatris 4a23f61
Remove redirect to task within `withRedirect` guard
LauraBeatris 2500054
Navigate to tasks from sign up context
LauraBeatris 5d39a6c
Remove `NavigateToTask` control component
LauraBeatris 72108b2
Add redirect guards for root sign-in / sign-up AIOs
LauraBeatris 4a09b4d
Use `taskUrl` from AIOs navigation
LauraBeatris 3e54a20
Validate task options on Clerk init
LauraBeatris c87cca9
Adjust unit tests with newest API
LauraBeatris 15baab2
Remove `#handlePendingSession` branch and introduce `navigate` option
nikosdouvlis fb0b6f0
Replace `onPendingSession` with `navigate`
LauraBeatris dd5a3c5
Add unit tests for invalidation hooks
LauraBeatris 250ded9
Fix display name of redirect guards
LauraBeatris 3d4a2e4
Rename `navigateToTask` from `navigateIfTaskExists`
LauraBeatris af7a4c7
Add warning for missing params for task handling
LauraBeatris e189667
Fix navigation between sign-in/sign-up steps
LauraBeatris 7486db5
Preserve `redirectUrl` on `taskUrl` for after sign-in/sign-up
LauraBeatris 6184aab
Add changesets
LauraBeatris 6feb7ea
Navigate to next task if any from AIOs
LauraBeatris 83a60c9
Fix `warnMissingPendingTaskHandlers` call
LauraBeatris 968a327
Add `@inline` to `SetActiveNavigate` type
LauraBeatris 9bde4ec
Fix navigation on active sessions
LauraBeatris 0279ddc
Fix mocking of `signedInSessions`
LauraBeatris 9c42234
Update custom flow snippet from changeset
LauraBeatris 8dfc782
Fix typedoc tests
LauraBeatris 735fb72
Fix navigation for multi-session
LauraBeatris 921f611
Use `navigate` for `setActive` on combined flow
LauraBeatris c0d8c27
Rename `RedirectToTask` control component to `RedirectToTasks`
LauraBeatris cf7f966
Fix E2E test for sign-up with tasks
LauraBeatris cb553fe
Display root sign-in for multi-session mode with tasks
LauraBeatris 7e590ff
Fix navigating to tasks on SSO callback
LauraBeatris 5356efe
Bump max size of `clerk.headless` bundle
LauraBeatris 17e01a4
Remove condition to always send `redirect_url` for SSO with after-aut…
LauraBeatris 4142162
Remove duplicated changeset
LauraBeatris 2171310
Remove `SessionTasksContext` from `TaskChooseOrganization`
LauraBeatris a9ec4dd
Fix `redirectUrl` for SSO with SignIn
LauraBeatris 8626d49
Run `onAfterSetActive` if the new session is `active`
LauraBeatris e1e3628
Always use the latest session for status checks
nikosdouvlis 508f7e0
Fix early returns in setActive
nikosdouvlis e800a1d
Fix session status check within `setActive`
LauraBeatris f492e9a
Maintain base URL of sign-in/sign-up for routing
LauraBeatris 5ad3f51
Fix navigation for SSO to maintain path and hash routing
LauraBeatris a85cecd
Fix `RedirectToTasks` to only redirect to tasks
LauraBeatris 1921845
Fix navigation for combined flow
LauraBeatris 2de7d6e
Fix changeset
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 router.push('/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,10 @@ | ||
--- | ||
'@clerk/tanstack-react-start': minor | ||
'@clerk/react-router': minor | ||
'@clerk/nextjs': minor | ||
'@clerk/clerk-react': minor | ||
'@clerk/remix': 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.