Skip to content
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]: v7_relativesplatpath migration produces error "Matched leaf route at location [path] does not have an element or Component" #12267

Open
foucdeg opened this issue Nov 12, 2024 · 5 comments
Labels

Comments

@foucdeg
Copy link

foucdeg commented Nov 12, 2024

What version of React Router are you using?

6.28.0

Steps to Reproduce

Following the docs from https://reactrouter.com/en/main/upgrading/future#v7_relativesplatpath :

  1. Activate v7_relativeSplatPath
  2. Migrate
<Route path={`${Routes.partstore.home}*`} element={<LoadablePartStoreRoutes />}>

to

<Route path={Routes.partstore.home}>
  <Route path="*" element={<LoadablePartStoreRoutes />} />
</Route>

Note: Routes.partstore.home === '/parts/'

  1. Navigate to /parts/ via URL.

Expected Behavior

The index for the subrouter at <LoadablePartStoreRoutes /> should render.

Actual Behavior

  • An empty page is displayed
  • The following error is printed to the console:

Matched leaf route at location /parts/ does not have an element or Component.

  • Breakpoints at module level inside LoadablePartStoreRoutes aren't reached.
@foucdeg foucdeg added the bug label Nov 12, 2024
@foucdeg foucdeg changed the title [Bug]: v7_relativesplatpath migration produces error "Matched leaf route at location [path] does not have an element or Component" [Bug]: v7_relativesplatpath migration produces error "Matched leaf route at location [path] does not have an element or Component" Nov 12, 2024
@JoshGiacopini
Copy link

Having the same problem. Followed the recommended migration guide and it's not working.

@foucdeg
Copy link
Author

foucdeg commented Nov 14, 2024

Also worth noting that the docs for Route show a "TODO" under route nesting, which is the recommended pattern used here.

@rekul

This comment was marked as duplicate.

@lhartvik
Copy link

Any workaround for this issue?

@foucdeg
Copy link
Author

foucdeg commented Nov 22, 2024

@lhartvik I don't have one. I'm just not upgrading to v7 for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants