Shallow routing with dynamic routes: [...slug] #13212
Replies: 5 comments 9 replies
-
I have the same issue on my end, would be nice to know what's the best practice here. |
Beta Was this translation helpful? Give feedback.
-
You can only use shallow routing to the same page under the |
Beta Was this translation helpful? Give feedback.
-
@andrewmclagan i'm tired your solution, its worked. Thanks |
Beta Was this translation helpful? Give feedback.
-
Also having this issue and it's quite jarring in our application — how bad is using |
Beta Was this translation helpful? Give feedback.
-
https://codesandbox.io/s/zen-pine-b3556 It works fine. Notice that Edit, didn't notice that this is the old discussion. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When attempting shallow routing with a dynamic route in Next.js the page is refreshed and shallow ignored. Seems allot of people are confused about this.
Say we start on the following page
Then we route to another blog post:
This does not trigger shallow routing, the browser refreshes, why?
In the codebase its very clear that this is a feature:
I can achieve the same manually using
window.history.pushState()
although this would of course be a bad idea:As the internal API of Next.JS could change at anytime... I may be missing something... but why is shallow ignored in the case? Seems odd.
Beta Was this translation helpful? Give feedback.
All reactions