Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there a way to prevent nested router re-rendering the whole page everytime #285

Open
putrasurya opened this issue Nov 24, 2022 · 2 comments

Comments

@putrasurya
Copy link

I realized when having 3-level nested routes, every time the URL changes the whole page gets re-render every time.
is it expected? or am I missing some configuration?

thank you

@ItalyPaleAle
Copy link
Owner

If the URL change impacts the outmost router, yes this is how it's supposed to work.

Do you need 3 nested routers? Or are you able to "flatten" it? Although nested routers are supported, I would consider them as "backup" option and would recommend flattening whenever possible.

@putrasurya
Copy link
Author

putrasurya commented Nov 26, 2022

yes, we sometimes need 3 nested routers or more when building not really a complex web app to memorize a page state by URL

a simple case looks like this one

/dashboard/
/dashboard/email
/dashboard/email/read/id

when you are at page /dashboard/email and assuming you have 2 panes, the left pane is a list of emails and the right pane is for email content, and here you are already at level 2 of nested routers

when reading emails it feels odd when the browser re-rendered every time I go through emails, here you are at 3 levels of nested routers (/dashboard/email/read/id). the browser flashed a white screen for a very short moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants