Parent CompatRoute with nested v6 Routes and Route re-renders when a child route changes in PROD #10214
Unanswered
josuebill
asked this question in
v5 to v6 Migration
Replies: 1 comment
-
Were you able to fix this? What approach did you take? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is what my current migration looks like (in summary). It works great in development mode. We're using a custom configuration of webpack and we added Nx later on for monorepo management. I thought the migration was going great. It's even faster than it was before! However, I realized that it behaves differently when I start the app in PROD mode. I noticed this when I deployed my changes to a test environment built for prod. I was able to recreate the behavior locally starting my app with
NODE_ENV=production
Here's what happens in prod mode. Whenever I navigate to one of the child routes inside the migrated Route that's using the
CompatRoute
, the whole CompatRoute re-renders and refetches the data parent. The child route appears as a drawer on the right hand side of the screen, which fetches the details for that item. But at the same time, behind that drawer, is the table of items being loaded again. When I close the drawer, which naturally navigates back to the parent route, the table reloads again. I don't know if this library is doing something different when built for production, or if it's the redirect way up there. I've tried many optimization techniques, like making sure components that fetch data are isolated (data is loaded where it's needed, instead fetching it way up in the tree and passing the data down as props). But I realized that wasn't it. I even created a fake route with child routes, witch fake data fetchers but it behaves exactly the same. Somewhere, when it's built for prod, something is making the parent route re-render whenever the v6 child routes change.Any thoughts on this? Have you experience the same issue? What have you done to fix it? I'll try to recreate this issue in a sandbox environment and post it here later on. Just wanted to get initial thoughts.
Beta Was this translation helpful? Give feedback.
All reactions