-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
fix(react-router): run action handlers for routes with middleware even if no loader is present #14443
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(react-router): run action handlers for routes with middleware even if no loader is present #14443
Conversation
…n if no loader is present
🦋 Changeset detectedLatest commit: 7e53983 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 |
middleware && middleware.length > 0 && !loader && !lazy; | ||
middleware && middleware.length > 0 && !loader && !action && !lazy; | ||
|
||
if (callHandler && !isMiddlewareOnlyRoute) { |
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.
if (callHandler && !isMiddlewareOnlyRoute) { | |
if (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) { |
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.
Thanks! I changed the fix up slightly to limit the loader/lazy check to GET requests only
🤖 Hello there, We just published version Thanks! |
thank you! 😆 |
fixes #14429
Previously, routes that only defined an action and had middleware could fail to
invoke the action unless at least one loader was present in the matched route tree.
This patch ensures the middleware execution path correctly handles action-only routes by always executing the
action phase even when no loaders are found.