-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
I'm trying to use the new feature in v4 of MUI that allows you to disable certain time ranges and I am facing an issue where the onChange function is triggering when it's not supposed to.
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
I have a controlled component that uses the Time Picker and receives it's value and change function from a parent component. When I click to open the time picker, the modal opens up showing hours and minutes (as expected), when I click on a new hour, this change is instantly submitted and the onChange function runs and my component re-renders with the new value and the modal closes. The sane happens when I click to change from AM to PM, the onChange function runs re-rendering my component and closing the modal as a result. This actually happens for any time change.
Expected Behavior 🤔
What I expected to happen is something similar to the v3.2.10 release where the onChange function is only triggered when the user submits their value by clicking the "ok" button, and is able to discard the pending changes they made by clicking the "cancel" button, meaning the onChange function would only run when the user has submitted their final time choice.
Steps to Reproduce 🕹
Steps:
Context 🔦
Your Environment 🌎
| Tech | Version |
|---|---|
| @material-ui/core | v4.11.0 |
| @material-ui/pickers | v4.0.0-alpha.12 |
| React | 16.13.1 |
| Browser | Chrome |
| TypeScript | |
| etc. |