Improving Calendar List performance #2756
Open
+8,761
−12,207
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces performance improvements and new customization options to the calendar components. The main focus is on optimizing rendering through React hooks like
useMemoanduseCallback, and adding flexibility to theCalendarListcomponent by allowing dynamic control over page height and number of pages. These changes help reduce unnecessary recalculations and re-renders, making the calendar more efficient and easier to configure.Performance and rendering optimizations
Calendarcomponent to useuseMemoanduseCallbackfor rendering days, weeks, months, and header, minimizing unnecessary recalculations and improving performance. (src/calendar/index.tsx) [1] [2] [3] [4] [5] [6]useEffect, ensuring styles are always up-to-date when the theme changes. (src/calendar/index.tsx)Customization and prop handling
calendarHeightandnumberOfPagestoCalendarListProps, allowing dynamic control of calendar page height and the number of pages displayed. (src/calendar-list/new.tsx)CalendarListto use the new props forpageHeightandonReachNearEdgeThreshold, making the component more flexible for different use cases. (src/calendar-list/new.tsx)Prop extraction and usage fixes
CalendarListto usecalendarPropsinstead of all props, ensuring correct prop usage for header rendering. (src/calendar-list/new.tsx)headerPropsinto theCalendarcomponent, relying on direct prop passing and memoized extraction. (src/calendar-list/new.tsx)Gesture handling
Calendarcomponent, improving swipe handling and preventing unnecessary re-renders. (src/calendar/index.tsx) [1] [2]These changes collectively improve the efficiency, maintainability, and configurability of the calendar components.