You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm testing react-router 6.4.3 before an upgrade, following the tutorial, and there seems to be some unnecessary renderings.
With a build version, when navigating through the sidebar contacts list, clicking on one contact triggers two renderings of the Root component, with the contacts lists being logged twice in the console.
Also, again when clicking on a contact, the actual displayed contact is rendered before the URL change, followed by a rendering of the newly displayed contact, and so on: each time a contact is clicked, there are two renderings of the Contact component.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm testing
react-router 6.4.3
before an upgrade, following the tutorial, and there seems to be some unnecessary renderings.With a build version, when navigating through the sidebar contacts list, clicking on one contact triggers two renderings of the
Root
component, with the contacts lists being logged twice in the console.Also, again when clicking on a contact, the actual displayed contact is rendered before the URL change, followed by a rendering of the newly displayed contact, and so on: each time a contact is clicked, there are two renderings of the
Contact
component.Code excerpts:
These are the traces logged when clicking on one contact:
Should not the sidebar contacts list be logged and the
Root
component be rendered only when the contacts list changes and not on navigation ?How to prevent those unnecessary renderings (and hence unnecessary DB queries upper in the chain) ?
Beta Was this translation helpful? Give feedback.
All reactions