-
Notifications
You must be signed in to change notification settings - Fork 402
chore(clerk-js): Enable UI Components to use setActive with router.navigate
#5077
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
chore(clerk-js): Enable UI Components to use setActive with router.navigate
#5077
Conversation
…Active and Clerk.navigate inside UI components
…Active This way we do not need to change the public signature of setActive, or remove the deprecation of beforeEmit, since developers that consume the sdk should still use `redirectUrl`.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 5bc5a88 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
setActive with router.navigate
…still-mounted-after-delete
|
Currently linting is expected to fail, until all |
|
Why was Also, I wonder if there's a better expression of this idea that we could safely expose as a public API? |
|
Alternative solution #5092 got approval, so I will be closing this |
Description
General Problem
Since the deprecation of
setActive({ beforeEmit }), our UI components have been usingClerk.navigatein order to navigate whensetActive({ redirectUrl })is set. Instead our UI components should be usinguseRouter().navigatein every occasion since it is has some extra handy capabilities.Specific use-case
This buggy behaviour is clearly visible, when you attempt to delete a user from UserProfile rendered in a modal. Upon deletion,
setActive({redirectUrl})was called, but when a soft navigation occurred (using framework router) the modal would not close, and the backdrop was clearly visible.Solution
This solution in this PR fixes the above issues while maintaining
setActivesimple to use for developers. We also still discourage the explicit usage ofsetActive({beforeEmit})Fixes the e2e test case that fails in #5071
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change