Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -412,19 +412,19 @@ export const useFieldState = <

// If `prop.value` changes, we update the state to reflect the new value
if (value !== state.lastExternalValue) {
let sections: InferFieldSection<TValue>[];
if (
const isActiveDateInvalid =
sectionToUpdateOnNextInvalidDateRef.current != null &&
!adapter.isValid(
fieldValueManager.getDateFromSection(
value,
state.sections[sectionToUpdateOnNextInvalidDateRef.current.sectionIndex],
),
)
) {
);
let sections: InferFieldSection<TValue>[];
if (isActiveDateInvalid) {
sections = setSectionValue(
sectionToUpdateOnNextInvalidDateRef.current.sectionIndex,
sectionToUpdateOnNextInvalidDateRef.current.value,
sectionToUpdateOnNextInvalidDateRef.current!.sectionIndex,
sectionToUpdateOnNextInvalidDateRef.current!.value,
);
} else {
sections = getSectionsFromValue(value);
Expand All @@ -435,11 +435,9 @@ export const useFieldState = <
lastExternalValue: value,
sections,
sectionsDependencies: { format, isRtl, locale: adapter.locale },
referenceValue: fieldValueManager.updateReferenceValue(
adapter,
value,
prevState.referenceValue,
),
referenceValue: isActiveDateInvalid
? prevState.referenceValue
: fieldValueManager.updateReferenceValue(adapter, value, prevState.referenceValue),
tempValueStrAndroid: null,
}));
}
Expand Down
Loading