URL doesn't update when clicking <Link> #14540
-
Hi! I'm trying to update my URL without having a page reload. The idea is that on URL change, a modal would open in the current page. However, I'm seeing an exception throwing up on my console, which breaks my logic. This is the origin URL: and the target URL would be:
My pages folder contain the following structure:
Everything works fine if I'm deep linking or navigating through a link between these pages. However, as I mentioned, I need to only update the URL. To do so, I'm using "shallow={true}" in my component. Something like: From /rent/mountain-view, I have:
The error I get is something saying that my "as" attribute is not compatible with "href", which I literally understand. But if this is the case, how would I achieve my goal? CURIOSITIES:
to
It works, however, after a few seconds, the page refreshes automatically and my logic goes down the toilet... |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Helllo @eduardo305 ! Try adding |
Beta Was this translation helpful? Give feedback.
-
As far as I know, shallow routing only works with query string parameters, not changing route paths. |
Beta Was this translation helpful? Give feedback.
-
I have one more update in this case. I downloaded this example: https://github.com/vercel/next.js/tree/canary/examples/with-route-as-modal which works really well. Then I created the folders rent/[city] and placed the existing code inside of it. Obviously I updated the href and as attributes accordingly. And surprisingly the same issue happens here. So I'm pretty sure now that this is a limitation of the framework. I believe we could classify it as a bug. Any thoughts? |
Beta Was this translation helpful? Give feedback.
I have one more update in this case. I downloaded this example:
https://github.com/vercel/next.js/tree/canary/examples/with-route-as-modal
which works really well. Then I created the folders rent/[city] and placed the existing code inside of it. Obviously I updated the href and as attributes accordingly. And surprisingly the same issue happens here. So I'm pretty sure now that this is a limitation of the framework. I believe we could classify it as a bug. Any thoughts?