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

[pickers] Unify PickersMonth and PickersYear behaviors #6034

Merged
merged 19 commits into from
Sep 9, 2022

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Sep 5, 2022

Fixes #5465
Fixes #4459

  • Have the same exact behavior between PickersMonth and PickersYear
  • Have the same exact behavior between MonthPicker and YearPicker
  • Spread props to the root on MonthPicker and YearPicker (requires removing the ...other props to YearPicker in CalendarPicker)

@alexfauquette I hope I did not introduce any regression in your recent improvements.

@flaviendelangle flaviendelangle added bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! labels Sep 5, 2022
@flaviendelangle flaviendelangle self-assigned this Sep 5, 2022
@flaviendelangle flaviendelangle changed the title [pickers] Unify PickersMonth and PickersYear behaviors [pickers] Unify PickersMonth and PickersYear behaviors Sep 5, 2022
@flaviendelangle flaviendelangle changed the title [pickers] Unify PickersMonth and PickersYear behaviors [pickers] Unify PickersMonth and PickersYear behaviors Sep 5, 2022
@mui-bot
Copy link

mui-bot commented Sep 5, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 517.8 823.8 569.9 632.46 119.128
Sort 100k rows ms 567.5 1,006.7 856.6 844.86 147.572
Select 100k rows ms 190.6 298.9 269.3 249.46 47.055
Deselect 100k rows ms 126.4 306.1 178.3 194.36 62.859

Generated by 🚫 dangerJS against be8916d

packages/x-date-pickers/src/MonthPicker/PickersMonth.tsx Outdated Show resolved Hide resolved
if (onMonthFocus) {
onMonthFocus(month);
}
const focusMonth = useEventCallback((month: number) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

I used useEventCallback everywhere because we don't have any useEffect listening to callback changes.
And we are passing callbacks to child component and so we were re-rendering every month / year each time those callbacks changed.

@flaviendelangle flaviendelangle marked this pull request as ready for review September 5, 2022 14:06
Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

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

Does no seems to introduce any regression 👌

@flaviendelangle
Copy link
Member Author

I have an Argos diff, I'll see if we want to exactly replicate the old UI

@flaviendelangle
Copy link
Member Author

I think the diff makes sense

@flaviendelangle flaviendelangle changed the base branch from master to next September 9, 2022 09:35
@flaviendelangle flaviendelangle merged commit 3e7bfb2 into mui:next Sep 9, 2022
@flaviendelangle flaviendelangle deleted the pickers-month branch September 9, 2022 09:36
oliviertassinari pushed a commit to oliviertassinari/mui-x that referenced this pull request Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module!
Projects
None yet
4 participants