-
Notifications
You must be signed in to change notification settings - Fork 265
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
fix(clerk-js): Add push/replace props & replace state when merging fragment into url #1304
Conversation
🦋 Changeset detectedLatest commit: 7f1a039 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 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 |
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.
✅ Great news! Jit hasn't found any security issues in your PR. Good Job! 🏆
18638b8
to
42350f6
Compare
This is a good change, but there's a reasonable chance it will lead to errors. The issue is we can't predict if we're setting an appropriate state variable for the framework's router. We probably won't see an issue unless we:
The back button will fire the Window popstate event, which the framework's router will be listening to so it can update it's own internal state. At that point, it's possible the framework can get confused by our manual entry via Passing This issue is why we don't call The safer approach for this fix is to use the framework's wrapper around I've been thinking we should accept both |
@colinclerk We'll do some more tests to make sure this works, if we're going to go ahead with it. I didn't think accepting a |
39e05ed
to
2e8a973
Compare
d664719
to
356d2d1
Compare
356d2d1
to
c1fe07e
Compare
5028633
to
20c4eb1
Compare
20c4eb1
to
6adc889
Compare
08b376b
to
265a880
Compare
265a880
to
df3094c
Compare
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.
Implementation looks good, seems like CI is failing though.
9e9b31f
to
feb73d6
Compare
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.
Please also add the changes to the Upgrade v4 -> v5 Guide [DRAFT]
.
@desiprisg let's please add at least one e2e test to cover this. |
feb73d6
to
ed4ac78
Compare
ed4ac78
to
7f1a039
Compare
Type of change
Packages affected
@clerk/clerk-js
@clerk/clerk-react
@clerk/nextjs
@clerk/remix
@clerk/types
@clerk/themes
@clerk/localizations
@clerk/clerk-expo
@clerk/backend
@clerk/clerk-sdk-node
@clerk/shared
@clerk/fastify
@clerk/chrome-extension
gatsby-plugin-clerk
build/tooling/chore
Description
npm test
runs as expected.npm run build
runs as expected.When using path routing and clicking on a sign-in/up link, we get rerouted to a hash based url which automatically gets converted to a path based url (that's happening inside PathRouter.tsx). After that, when the back button is pressed, we arrive at the hash-based url that got converted and not at the actual previous page we were on.
Solution: Add a
routerReplace
prop to<ClerkProvider/>
and use that for merging the fragment into the url.Edit: This PR also includes the new
routerPush
prop that replaces thenavigate
prop for v5.Before:
Screen.Recording.2023-05-26.at.03.39.21.mov
After:
Screen.Recording.2023-05-26.at.04.38.49.mov