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

Add cache for isDayBlocked and isOutsideRange in DayPickerRangeContro… #2147

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

glintik
Copy link

@glintik glintik commented Sep 21, 2021

…ller.

Proposed solution to cache modifiers result from #2140 to improve rendering performance.
@ljharb please take a look.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any tests that could illustrate how this helps?

src/components/DayPickerRangeController.jsx Outdated Show resolved Hide resolved
@@ -1111,6 +1110,42 @@ export default class DayPickerRangeController extends React.PureComponent {
return { currentMonth, visibleDays };
}

getCachedPropByDay(day, prop, props, forceUpdate = false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason this is cached on the instance, instead of being done in react state?

src/components/DayPickerRangeController.jsx Outdated Show resolved Hide resolved
glintik and others added 2 commits November 30, 2021 20:46
Co-authored-by: Jordan Harband <ljharb@gmail.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
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

Successfully merging this pull request may close these issues.

None yet

3 participants