-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[Bug]: pathless route throw no action method found #9284
Comments
Moving const router = createBrowserRouter([
{
path: "/",
element: <Root />,
errorElement: <ErrorPage />,
loader: rootLoader,
children: [
{
errorElement: <ErrorPage />,
action: rootAction, // 👈 move it here
children: [
// the rest of the routes
],
},
],
},
]); |
Yes indeed, but I would think that it kind break the semantics (a comprehension benefits) of defining the action & loader of a route within its given route object. WYDT ? |
Thanks for the explanation! This looks like a bug as pathless layout routes should be ignored for form actions, and this should correctly find the root action. We'll get a fix in soon! |
Thanks ! |
Merged the fix for this - should be available in a 6.4.3 hopefully later this week or next week 👍 |
Thanks for your work @brophdawg11 |
👋 Just did a prerelease ( |
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
What version of React Router are you using?
v6.4
Steps to Reproduce
Follow the react-router tutorial including the pathless route section
If implemented as suggested, the root action implemented earlier in the tutorial to create a contact will not work anymore.
Expected Behavior
The root action should work correctly or the tutorial should explain and provide a workaround.
Actual Behavior
React router will throw the following error :
react_devtools_backend.js:4026 ErrorResponse {status: 405, statusText: 'Method Not Allowed', data: 'No action found for [/]'}
Router configuration when the error happen:
Router configuration to remove the error and allow the action to be performed:
Nb: the following router config will remove the error but prevent the action to be performed:
The text was updated successfully, but these errors were encountered: