mui-x
mui-x copied to clipboard
[pickers] fix to trigger `onChange` when clearing not empty value
Fixes #5690
Force trigger an onChange call when clicking clear button with not empty value.
Covers case, when date picker has Invalid date due to manual entry, but internally the state is saved as null already.
Simply adding a check in setDate function causes inconsistent behaviour, where simply closing the picker would also reset an invalid value.
These are the results for the performance tests:
| Test case | Unit | Min | Max | Median | Mean | σ |
|---|---|---|---|---|---|---|
| Filter 100k rows | ms | 282.2 | 561 | 413.8 | 396 | 101.913 |
| Sort 100k rows | ms | 500.5 | 1,117.8 | 736.7 | 861.72 | 218.296 |
| Select 100k rows | ms | 199.5 | 304.2 | 259.5 | 257 | 41.921 |
| Deselect 100k rows | ms | 139.6 | 270.9 | 176.1 | 194.28 | 47.292 |
Generated by :no_entry_sign: dangerJS against 0893886b5be4173d246c43db4ad27f011658410a