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

[CalendarPicker] Don't move to closest enabled date when props.date contains a disabled date #6537

Merged
merged 1 commit into from Oct 17, 2022

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Oct 17, 2022

Fixes #4705 for master (equivalent of #6146)

@flaviendelangle flaviendelangle added the component: pickers This is the name of the generic UI component, not the React module! label Oct 17, 2022
@flaviendelangle flaviendelangle self-assigned this Oct 17, 2022
@mui-bot
Copy link

mui-bot commented Oct 17, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 503.4 1,055.2 555.8 697.82 207.351
Sort 100k rows ms 592.5 1,027 1,027 888.32 168.71
Select 100k rows ms 150.7 302.5 276.8 249.76 54.28
Deselect 100k rows ms 141.6 233.7 186.3 181.88 34.546

Generated by 🚫 dangerJS against fa95fb7

@alexfauquette alexfauquette merged commit 3f3053d into mui:master Oct 17, 2022
@flaviendelangle flaviendelangle deleted the master-6146 branch October 17, 2022 06:17
@traverse
Copy link

Hello, this actually caused some tests to fail on my end. I'm wondering why this wasn't considered a breaking change?

@flaviendelangle
Copy link
Member Author

It was considered a bug fix because the existing behavior could lead to UI freeze.

@traverse
Copy link

Thanks for your reply @flaviendelangle.

I can understand that this was considered a bugfix but this was existing behavior that people might've been relying on like I did. The fix on my end was pretty straightforward but I can imagine it also breaking things for other people.

I'm not sure how strictly MUI adheres to semver and I don't want to be pedantic about it but I would consider this a breaking change even if it was a bugfix.

@flaviendelangle
Copy link
Member Author

We could probably have added a temporary prop until v6 to opt-out of the behavior instead of removing it altogether, you are right

@Aerophite
Copy link

Aerophite commented Jan 5, 2023

What was the rationale behind removing this? Removal of this behavior has really messed up my application as we relied on this happening. Any suggestions on how to get this effect without me having to create all the logic myself? I tried importing your internals directly (which I don't really want to do) but that doesn't work since my project is in CRA and Jest within it can't import ESM scripts...

Seems like this should have been an optional opt-in/out prop rather than a removal. And not just a temporary prop for removal later.

@flaviendelangle
Copy link
Member Author

Hi,

Could you describe why this removal broke your application ?
We could add it back as an opt-in option with a warning saying that if the closest enable date is fare away, it will have terrible performances.

@Aerophite
Copy link

Aerophite commented Jan 5, 2023

We have multiple date pickers within multiple rows of a table that, when you select dates in other rows, disables dates for rows that will be created later. In some instances, this means that we disable entire months at a time in the past/future as well as "today". We were relying on this to switch, if "today" is disabled, move to the next available non-disabled date.

For example, if we disabled the past and this month, we'd have wanted it to select the first day of the next month.


We are perfectly fine with the potential performance hit when using the feature with far-away dates.

@flaviendelangle
Copy link
Member Author

In the past, the switch occurred when opening the picker.
Is this the intended behavior for you ?
Would it make sense to move to the closest enabled date on the picker's mount instead ?

@Aerophite
Copy link

We are only relying on it happening when the picker is opened. We wouldn't want it on mount since we would want to display previously input values, even if they are disabled now. For example, if we selected a date previously that is now disabled, we wouldn't want that date to now start changing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants