Replies: 2 comments
-
I also tried using first As @Alecell I tried using |
Beta Was this translation helpful? Give feedback.
-
Hi, this sounds related to #16028 which was fixed in #16477 and is available on the latest canary of Next.js If I'm misunderstanding and you are instead requesting to be able to do shallow routing when navigating to a different page e.g. from |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Feature request
It would be awesome if Next support
shallow
change URL without reload the page withpathname
. We have so many cases that is useful and user-friendly change URL without redirect, only changing the currentpathname
as thehistory.pushState
does.Is your feature request related to a problem? Please describe.
Currently we can use the
pushState
method to change URL without reload, but it's followed with a bug thatasPath
has some strange behavior that sometimes it get the current URL correctly, but sometimes don't, it get the previous URL.Currently I have a multiple list of, lest say, developers, each lists represent a list of developers main language. So for example we have 3 lists a list of Python developers, Node developers and C. The URL of this page is
/developers/[language]
, we start at/developers/python
, but when we swipe left (thinking on mobile experience) I need the URL to change from/developers/python
to/developers/node
, no need of reload the page that hurts the user experience.So far, the
pushState
handle the case, but if we have a click on the developer that leads to a URL like/developers/[language]/[id]
, so lets suppose we start at/developers/python
, swipe and go to/developers/node
and click on a developer, at this point I'm facing a problem a problem that seems the nextRouter
don't update its routes whenpushState
is used, so theasPath
has the old URL/developers/python
instead of/developers/node
.Describe the solution you'd like
I know, by the way I believe, that is a expected error, as I'm changing the URL without the
Router
object so it makes sense to it don't update, but I'm using thepushState
since Next don't handleshallow
routing withpathname
, only withquery params
.It would be awesome if Next has the feature to allow
shallow
routing withpathname
since there are use cases that makes much sense to change URL without reload the page.Describe alternatives you've considered
The alternative is just the
pushState
, but it isn't much useful since it leads to a bug forcing to use thewindow.location
and replacing the location when have url params.Additional context
I did not know if have a good reason to Next don't handle
shallow
routing withpathname
but since I posted a question about this here and I didn't get an answer, I beleived that isn't.Beta Was this translation helpful? Give feedback.
All reactions