-
Notifications
You must be signed in to change notification settings - Fork 290
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): Extend client cookie lifetime #4312
Conversation
🦋 Changeset detectedLatest commit: 0b873da The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 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 |
!snapshot client-touch |
Hey @issuedat - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact |
void context.clerk.setActive({ session, beforeEmit }); | ||
void context.clerk.setActive({ | ||
session, | ||
redirectUrl: context.router?.searchParams().get('redirect_url') || context.clerk.buildAfterSignInUrl(), |
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.
@brkalow would this change the behavior of the AIO components? My understanding is that Clerk#navigate
will use the routerPush
/routerReplace
functions passed to ClerkProvider
so it should be okay, just want to verify that this is true for the AIO components as well.
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.
It should be okay for this case 👍 will test
void context.clerk.setActive({ session, beforeEmit }); | ||
void context.clerk.setActive({ | ||
session, | ||
redirectUrl: context.router?.searchParams().get('redirect_url') || context.clerk.buildAfterSignUpUrl(), |
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.
Ditto
}) => { | ||
if (typeof ctx.afterSelectPersonalUrl === 'function' && user) { | ||
return navigate(ctx.afterSelectPersonalUrl(user)); | ||
return ctx.afterSelectPersonalUrl(user); |
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.
This does make sense to me, but before merging, I'd like to verify that the router the components use internally still updates its state after the setActive invocation.
To share a bit of context, even though the clerk-js components will use the router of the parent host for navigations (routerPush
and routerReplace
) they still hold an internal router state (clerk-js/src/ui/RouteContext
). This state updates when navigate
is called but after this change, the internal navigate
invocation will be replaced by Clerk#navigate
.
@issuedat apologies, I know the names are confusing here. Tagging @panteliselef as well as he's most likely interested in this as well.
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.
This looks good to me! I left a few minor suggestions on moving some logic into Client
.
Nice work.
Co-authored-by: panteliselef <[email protected]>
Description
/v1/client/touch
endpoint to extend the__client
cookie's lifetime when the cookie expiration <= 8 daysbeforeEmit
in favor of passing aredirectUrl
tosetActive
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change