Open gauravsaini964 opened 1 year ago
I believe this is happening to us as well: we have a /objects/new
page, and after we submit the form we want to router.push
to /objects
, but that does not trigger a page change.
I suspect it's because we have a /objects/[objectId]/index.tsx
route, so I think next.js thinks we are changing the objectId
param rather than visiting a different route.
We fixed it by manually triggering router.push('/objects/index', '/objects')
Verify canary release
Provide environment information
Which example does this report relate to?
catch-all-routes
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Vercel
Describe the Bug
For some reason, my dynamic route is rendered instead of catch all route when I use router.push or Link component. But when I refresh the page, the exact same url renders correct catch all route page. Folder layout attached below.
getStaticPath Reference
pages/[category-slug]/[...category-concern-filter-slug]/index.jsx
pages/[category-slug]/[collection-slug]/[product-slug]/index.jsx
Expected Behavior
When I go to this url /hair/shop-by-hair-type-&-concern/dry-scalp-&-dandruff. Page stating 'concernssss' renders which is correct. That file is located at
pages/[category-slug]/[...category-concern-filter-slug]/index.jsx
When I try to do Router.push('/hair/shop-by-hair-type-&-concern/dry-scalp-&-dandruff'), it takes me to the error page which is trying to render file located at
pages/[category-slug]/[collection-slug]/[product-slug]/index.jsx
To Reproduce
Have catch all route in same directory as dynamic route and try Router.push.