#5 parallel routes results in 5×5 rerenders when doing router.push()

2 messages · Page 1 of 1 (latest)

fleet hound
#

(cross-posted from https://github.com/orgs/vercel/discussions/7151)

When doing router.push() inside a parallel route, all n parallel routes render n times.

Say there are 5 parallel routes. Ideally, when a new route is pushed, each parallel route should have been rendered only once. (see first image)

However, that is not what happens. Here is an example with 4 parallel routes. Each parallel route renders 4 times in total. (see second image)

And here is an example with 5 parllel routes. Each parallel route renders 5 times in total. (see third image)

Reproduction repo can be found here
https://github.com/revosw/nextparallelrepro

Steps to Reproduce:

  1. Clone repository
  2. Install dependencies
  3. Start development server and keep the server console open
  4. Press one of the "push route" buttons
  5. Notice how the server console (not the browser console) prints getA, getB, getC, getD and getE five times in succession. I have set getE to have a 5 second timeout.
GitHub

Contribute to revosw/nextparallelrepro development by creating an account on GitHub.

rain dustBOT
#

🔎 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)