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/$subId
10 Replies
national-gold•9mo ago
this might be a known bug
does this go away when you set
from
in the Link?equal-aquaOP•9mo ago
I have to put the
route.fullPath
from /route/$id/sub/$subId
in from field ?national-gold•9mo ago
would need a minimal example. but in general it should be the route where that link is rendered on
equal-aquaOP•9mo ago
The Link are in a global sidebar so the from field is updated a lot depending where the user is
national-gold•9mo ago
I will look into this
equal-aquaOP•9mo 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 worknational-gold•9mo 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 youequal-aquaOP•9mo 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 throwednational-gold•9mo ago
oh that's a completely different thing than I thought then 🤪
useParams({strict:false})
comes in handy hereequal-aquaOP•9mo ago
oh yes ! thank you so much for your help