Still a lot of re-renders in v9 #2255
Replies: 3 comments
-
Hey @ArthurGoupil, thanks for the heads up and for testing v9. The rerender is necessary to manage focus: when a day is clicked, the other cells need to know if they should become the "possible focus target." We may explore other ways to handle focus, but they are challenging to implement following React patterns. I believe the rerendering shouldn't be too concerning. I've moved out some of the calculations that made rerendering slow in the previous version. There are some upcoming changes that will further memoize the values used by DayPicker, thus reducing other unnecessary rerenders. |
Beta Was this translation helpful? Give feedback.
-
Alright thanks a lot for the answer @gpbl 🙏 |
Beta Was this translation helpful? Give feedback.
-
It is true there are still some useless re-renders when interacting with the calendar. For sure some of those are avoidable using If you have some suggestion give a look at https://github.com/gpbl/react-day-picker/blob/main/src/DayPicker.tsx. Modifiers, focus, creating new objects via spread are likely the reason the re-renders happen. We may also want to debounce keyboard interaction... I don't think these rerendering should be a concern for the release, but I can't exclude some improvements before the release. They can come as patch or minor upgrades once we have enough feedback from the users. Thanks for the heads-up - I'm moving this to the discussions. |
Beta Was this translation helpful? Give feedback.
-
Description
Hello!
I was following this issue for quite a long time #1473 and was happy to see it has been potentially fixed in v9.
From my first tests, it looks like when selecting a date, it still re-renders every days of every months:
Enregistrement.de.l.ecran.2024-06-24.a.13.47.36.mov
Here is the related sandbox
Am I missing something in the basic implementation or so?
Thanks a lot!
Expected Behavior
It does not re-render every days when not necessary.
Beta Was this translation helpful? Give feedback.
All reactions