Next.js Discord

Discord Forum

Shallow routing tabs with app router?

Unanswered
Gray Wagtail posted this in #help-forum
Open in Discord
Gray WagtailOP
I have a set of tabs that push a query parameter (same path) instead of just changing state (so you can navigate back and forth in the browser and the tabs will respond).

Previously in my other pages router app I could do a shallow router push and it'd be instant since no new page was loading. But that functionality has since been removed (or moved somewhere other than useRouter). Because right now the tabs are a bit sluggish since it takes a few hundred milliseconds for the new page to load.

So the question is, what should I do here? Is there a trick I can use with intercepting routes or something? Remember it's the same route, just a category query parameter that's being changed, not the pathname.

1 Reply

Gray WagtailOP
Would it be a good idea to router.prefetch all the possible tab URLs to make the navigation faster? Never used it before :hmmGe: