chore(react-router): Remove deprecated pre-middleware setup#7796
chore(react-router): Remove deprecated pre-middleware setup#7796wobsoriano merged 3 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: bc57b10 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
📝 WalkthroughWalkthroughThis pull request removes the legacy pre-middleware authentication flow from the React Router package. It deletes the legacyAuthenticateRequest implementation and its integration test, strips migration guidance from error utilities, and updates server code (getAuth, rootAuthLoader) to require middleware-provided auth context and throw when it is absent. Tests were adjusted to remove legacy mocks and expectations. Public API and behavior were simplified: rootAuthLoader’s signature changed, clerkMiddleware was introduced/exported, and legacy fallback paths and header-wrapping response behavior were removed. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@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: |
|
!allow-major |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.changeset/green-humans-yawn.md:
- Line 5: The breaking-change sentence in the changeset is inverted: update the
description text so it correctly states that using rootAuthLoader without
installing clerkMiddleware() will now throw a runtime error (i.e., the code
requires clerkMiddleware()), referencing the symbols rootAuthLoader and
clerkMiddleware() so readers know the affected API; replace the current "will
not throw a runtime error" phrasing with a clear "will throw a runtime error"
explanation and, optionally, add a brief migration note advising to install
clerkMiddleware() where rootAuthLoader is used.
| '@clerk/react-router': major | ||
| --- | ||
|
|
||
| Usage of `rootAuthLoader` without the `clerkMiddleware()` installed will not throw a runtime error. |
There was a problem hiding this comment.
Critical: Fix inverted logic in breaking change description.
The statement says "will not throw a runtime error" but based on the PR objectives and AI summary, the code now requires clerkMiddleware() and throws when it is absent. This is the opposite of what's documented.
This is critical because users rely on changeset documentation to understand breaking changes during migration.
📝 Proposed fix
-Usage of `rootAuthLoader` without the `clerkMiddleware()` installed will not throw a runtime error.
+Usage of `rootAuthLoader` without the `clerkMiddleware()` installed will now throw a runtime error.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Usage of `rootAuthLoader` without the `clerkMiddleware()` installed will not throw a runtime error. | |
| Usage of `rootAuthLoader` without the `clerkMiddleware()` installed will now throw a runtime error. |
🤖 Prompt for AI Agents
In @.changeset/green-humans-yawn.md at line 5, The breaking-change sentence in
the changeset is inverted: update the description text so it correctly states
that using rootAuthLoader without installing clerkMiddleware() will now throw a
runtime error (i.e., the code requires clerkMiddleware()), referencing the
symbols rootAuthLoader and clerkMiddleware() so readers know the affected API;
replace the current "will not throw a runtime error" phrasing with a clear "will
throw a runtime error" explanation and, optionally, add a brief migration note
advising to install clerkMiddleware() where rootAuthLoader is used.
Description
Removes support for the legacy pre-middleware setup in
@clerk/react-router. Apps must now useclerkMiddleware()to integrate Clerk.The middleware-based approach was introduced months ago and has been the recommended pattern since then. This change completes the migration by removing the legacy fallback path.
Resolves USER-4646
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
Refactor
New Features / Public API
Chores