Invariant failed useMatch
Hello,
I don't exactly why but sometime, when I click on a <Link><Link>, I have
Invariant failed which appear.
When I add a breakpoint, The error is 'could not find a nearest match'
My current setup for these routes are:
When I click on /routeA/$id, I fetch the entity and sub entity in the loader and then I throw a redirect to /route/$id/sub/$subId10 Replies
xenial-black•12mo ago
this might be a known bug
does this go away when you set
from in the Link?sunny-greenOP•12mo ago
I have to put the
route.fullPath from /route/$id/sub/$subId in from field ?xenial-black•12mo ago
would need a minimal example. but in general it should be the route where that link is rendered on
sunny-greenOP•12mo ago
The Link are in a global sidebar so the from field is updated a lot depending where the user is
xenial-black•12mo ago
I will look into this
sunny-greenOP•12mo ago
Invariant failed: Could not find an active match from "/_dashboard/retails/$retailId/product/$productId"
And here my route at product level
I have added from everytime where I redirect but it not workxenial-black•12mo ago
no you cannot use the same value as
to
it must be a currently rendered route
but it's only required when you use relative paths
i know where to investigate, will get back to yousunny-greenOP•12mo ago
Ok Thanks a lot
I found the solution 🎉 I used a
route.useParams() in a sidebar but I think sometime, the route was not the current route pattern so that why a error was throwedxenial-black•12mo ago
oh that's a completely different thing than I thought then 🤪
useParams({strict:false}) comes in handy heresunny-greenOP•12mo ago
oh yes ! thank you so much for your help