Next.js Discord

Discord Forum

Avoid rerender / refetch of parallel route

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
Hello there 👋.

So, I have a quite complex dashboard that utilizes dynamic rendering due to authorization. The file tree looks similar to this:

app/
+ dashboard/
+ + [[...path]]/
+ + + @teams/
+ + + @documents/
+ + + @inspector/

All those parallel routes are shown simultaneously in the dashboard's layout. Now, when a user selects a team, the documents of that team are shown (together with the team's data in the inspector). When a user selects a document, the inspector now shows the contents of that document.

I have these routes connected through Links, using the catchall route above. The catchall route contains at most [teamId, documentId].

When I navigate from one team to the other, I don't want the @teams route to refetch the data, only to rerender, since I am now showing the user what team they've selected. But I don't want another query to be made. Same for when selecting a document. I don't want the documents to be refetched nor rerendered, I only want the @inspector to be rerendered.

I mean, one solution may be to use basic components again. But at the same time, I want a sharable URL and use server actions.

How would I go about this? How would I refactor? Or what would you do differently?

I really need help! Thanks in advance

2 Replies

Barbary LionOP
// push
Barbary LionOP
well I guess the question is more about how I avoid rerendering a specific parallel route on navigation