#<Link> is changing URL but page content is not changing

14 messages ยท Page 1 of 1 (latest)

zealous quest
#

I've got these routes:

/locations/index.tsx
/locations/edit/[locationid].tsx

Each of these routes work perfectly in isolation. However, when the user navigates (using Link or router.push) from the second route to the first (i.e. back from a single location to the locations index), the URL in the browser changes, but the page content does not.

I'm 100% sure this is me not understanding something about sub-routes, so I'd be super grateful if someone could please show me the error of my ways! Many thanks ๐Ÿ™‚

real locustBOT
#

๐Ÿ”Ž This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      ๐Ÿ•ต๏ธ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      โœ… You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
dreamy oriole
zealous quest
dreamy oriole
#

then can you make a minimal repro repo?

#

if even in prod mode it suffers from that problem, then i'm fairly certain it is a nextjs bug

zealous quest
#

Sure!

zealous quest
dreamy oriole
# zealous quest Of course, in my minimal repro it works perfectly ๐Ÿ˜ฌ At least I now know it's a...

it's a problem at my end
not necessarily. i still suspect this to be a nextjs bug, it's just that your minimal repo fails to reproduce it.

a way to make a minimal repo that can reproduce the problem is by starting from the problematic repo you are having right now, then you delete irrelevant parts + simplify the repo gradually. at one point the problem will vanish, that's where you know where the problem is hiding at

zealous quest
#

@dreamy oriole Thanks very much for your help. I'm going to try your suggestion and will post the outcome here ๐Ÿ™‚

zealous quest
#

@dreamy oriole Arghhh, it was the a child component updating the parent's state incorrectly causing an endless re-render loop, which was presumably getting in the way of route changing process somehow. Doh! Thank you so much for your help ๐Ÿ™‚

dreamy oriole
#

i see, i assume you found the bug and resolved the issue, glad to hear you fixed that

#

yeah the method of making a minimal repro repo is sometimes also an effective debugging method

split shore