Skip to content

fix(clerk-js): Sync BaseRouter state on pushState/replaceState (core 2)#7863

Open
brkalow wants to merge 3 commits intorelease/core-2from
cherry-pick/fix-base-router-sync
Open

fix(clerk-js): Sync BaseRouter state on pushState/replaceState (core 2)#7863
brkalow wants to merge 3 commits intorelease/core-2from
cherry-pick/fix-base-router-sync

Conversation

@brkalow
Copy link
Member

@brkalow brkalow commented Feb 17, 2026

Summary

Cherry-pick of #7840 into release/core-2.

  • Syncs BaseRouter internal state when external code calls history.pushState / history.replaceState
  • Uses the Navigation API when available, with a monkey-patching fallback
  • Wraps internal navigation with flushSync to prevent stale state during setActive

Original PR: #7840

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Jacek Radko <jacek@clerk.dev>
@vercel
Copy link

vercel bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Feb 17, 2026 7:18pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cherry-pick/fix-base-router-sync

Comment @coderabbitai help to get the list of available commands and usage tips.

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2026

🦋 Changeset detected

Latest commit: 6a85991

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

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

@brkalow brkalow changed the title fix(ui): sync BaseRouter state on pushState/replaceState fix(clerk-js): sync BaseRouter state on pushState/replaceState Feb 17, 2026
@brkalow brkalow changed the title fix(clerk-js): sync BaseRouter state on pushState/replaceState fix(clerk-js): ync BaseRouter state on pushState/replaceState Feb 17, 2026
@brkalow brkalow changed the title fix(clerk-js): ync BaseRouter state on pushState/replaceState fix(clerk-js): Sync BaseRouter state on pushState/replaceState Feb 17, 2026
@brkalow brkalow added the core-2 label Feb 17, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 17, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7863

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7863

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7863

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7863

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7863

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7863

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@7863

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@7863

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7863

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7863

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7863

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7863

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7863

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7863

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@7863

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7863

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@7863

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7863

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7863

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7863

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@7863

@clerk/types

npm i https://pkg.pr.new/@clerk/types@7863

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7863

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7863

commit: 6a85991

@brkalow brkalow changed the title fix(clerk-js): Sync BaseRouter state on pushState/replaceState fix(clerk-js): Sync BaseRouter state on pushState/replaceState (core 2) Feb 17, 2026
Capture the bound original function in a local const to avoid
non-null assertions flagged by @typescript-eslint/no-non-null-assertion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant