How should useCurrentMatches work?

I'm trying to build a breadcrumb and tried to use useCurrentMatches in my solid-start app. But instead of multiple matches I only get one match of the full path, i.e. ['test1/test2/test3'] instead of ['test1', 'test2', 'test3']. How do I get the route info of all parent routes?
4 Replies
Madaxen86
Madaxen865d ago
useCurrentMatches will only return valid routes. So if there is no default export in test1 index.tsx (filerouting) or no Route with a component this path segment will not be returned by useCurrentMatches.
duckstape
duckstapeOP5d ago
I did that, without success. I reproduced my setup in this stackblitz: https://stackblitz.com/edit/github-grada5-8t8kru5v?file=README.md
RndUsername
StackBlitz
Solid-Start Breadcrumbs Problems - StackBlitz
Run official live example code for Solid-start Basic, created by Solidjs on StackBlitz
Madaxen86
Madaxen865d ago
Okay, I'd say that's a bug. I would also expect to get all parent routes. Would you mind opening an issue in https://github.com/solidjs/solid-router/issues
GitHub
Issues · solidjs/solid-router
A universal router for Solid inspired by Ember and React Router - Issues · solidjs/solid-router
duckstape
duckstapeOP5d ago
GitHub
useCurrentMatches only returns one match · Issue #528 · solidjs/s...
Describe the bug When I use useCurrentMatches with the FileRouter and nested paths, I only get one match, i.e. ['test1/test2/test3'] instead of ['test1', 'test2', 'test3...

Did you find this page helpful?