fix(clerk-js): complete the Safari ITP touch hop in redirect - #9308
Conversation
…ectUrl }) The `else if (redirectUrl)` branch navigated to `/v1/client/touch` and then immediately navigated again to the undecorated redirect URL. Where both resolve to a hard navigation, the second assignment supersedes the first and the touch request is aborted, so the client cookie is never extended past ITP's 7 day cap. Route the redirect through the shared #decorateUrlWithTouch helper instead, which returns the URL unchanged when the client is not eligible. The existing test asserted only navigate.mock.calls[0][0], so it stayed green across the regression; it now also asserts navigate is called exactly once. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: acfcfc6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 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 |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
@clerk/expressCurrent version: 2.1.49 Subpath
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
Definitely partial credit goes to Dylan who in a previous PR told me to reduce code duplication, and then when I added this |
The
else if (redirectUrl)branch navigated to/v1/client/touchand then immediately navigated again to the undecorated redirect URL. Where both resolve to a hard navigation, the second assignment supersedes the first and the touch request is aborted, so the client cookie is never extended past ITP's 7 day cap.This was a regression that was accidentally introduced in https://github.com/clerk/javascript/pull/6486/changes#diff-1952d6b8ac4b5495e1dba57c32bff9ce72d43f83595c1bc8532a76cf31feb753L1314 11 months ago, when an
elsein a nested control flow was accidentally dropped. I suspect it was not reported because Safari use is less common and the sign out would have only occurred after 7 days.Route the redirect through the shared #decorateUrlWithTouch helper instead, which returns the URL unchanged when the client is not eligible.
The existing test asserted only navigate.mock.calls[0][0], so it stayed green across the regression; it now also asserts navigate is called exactly once.
Description
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change