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

Perf rearchitecting #450

Merged
merged 1 commit into from
May 2, 2017
Merged

Perf rearchitecting #450

merged 1 commit into from
May 2, 2017

Commits on May 2, 2017

  1. Rearchitecture of how modifiers are maintained and updated

    Instead of passing down an object of modifier string => modifiers functions to each CalendarDay component and expecting the CalendarDay component to take care of updating itself, we now put the burden on the top of the tree instead of on the leaves. The previous model basically ended up meaning that whenever an interaction happened on an individual day, even a hover interaction, every single CalendarDay would have to recalculate its modifiers and rerender as a result. This was, as you can imagine, really god damn slow.
    
    In this new model, the DayPickerRangeController maintains a map with the following structure:
    ```
    {
      MONTH_ISO_1: {
        DAY_ISO_1: Set(['modifer_1', 'modifier_2', ...]),
        DAY_ISO_2: Set(['modifer_1', 'modifier_2', ...]),
        ...
      },
      ...
    }
    ```
    It passes this down the tree such that each `CalendarMonth` and each `CalendarDay` only gets the information that pertains to it. This means that the updating of these modifiers is also handled at the top-level and is done in the `componentWillReceiveProps`, `onDayMouseEnter`, and `onDayMouseLeave` methods of the `DayPickerRangeController`. Fortunately, this allows us to more finely tune which days get updated and speeds up the rerendering/updating process dramatically.
    Maja Wichrowska committed May 2, 2017
    Configuration menu
    Copy the full SHA
    c95cbed View commit details
    Browse the repository at this point in the history