Skip to content

Commit

Permalink
[pickers] Always use props.value when it changes
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle committed Nov 19, 2024
1 parent 625b38e commit aed244b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export const usePickerValue = <
draft: initialValue,
lastPublishedValue: initialValue,
lastCommittedValue: initialValue,
lastControlledValue: inValueWithTimezoneToRender,
lastControlledValue: inValueWithoutRenderTimezone,
hasBeenModifiedSinceMount: false,
};
});
Expand Down Expand Up @@ -302,15 +302,7 @@ export const usePickerValue = <
}
});

if (
inValueWithTimezoneToRender !== undefined &&
(dateState.lastControlledValue === undefined ||
!valueManager.areValuesEqual(
utils,
dateState.lastControlledValue,
inValueWithTimezoneToRender,
))
) {
if (dateState.lastControlledValue !== inValueWithoutRenderTimezone) {
const isUpdateComingFromPicker = valueManager.areValuesEqual(
utils,
dateState.draft,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export interface UsePickerValueState<TValue> {
*/
lastCommittedValue: TValue;
/**
* Last value passed with `props.value`.
* Last value passed to `props.value`.
* Used to update the `draft` value whenever the `value` prop changes.
*/
lastControlledValue: TValue | undefined;
Expand Down

0 comments on commit aed244b

Please sign in to comment.