From c2fa287ac594e25129708a15f3b71fb570631c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20S=C3=A1ros?= Date: Tue, 29 Oct 2024 17:07:55 +0100 Subject: [PATCH] fix(ui-date-input): fix DateInput2 to update messages properly --- packages/ui-date-input/src/DateInput2/index.tsx | 6 +++--- packages/ui-date-input/src/index.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/ui-date-input/src/DateInput2/index.tsx b/packages/ui-date-input/src/DateInput2/index.tsx index 1057dbe737..2ec8e3a47a 100644 --- a/packages/ui-date-input/src/DateInput2/index.tsx +++ b/packages/ui-date-input/src/DateInput2/index.tsx @@ -184,9 +184,9 @@ const DateInput2 = ({ useEffect(() => { // don't set input messages if there is an internal error set already - if (!inputMessages.length && !invalidDateErrorMessage) { - setInputMessages(messages || []) - } + if (inputMessages.find((m) => m.text === invalidDateErrorMessage)) return + + setInputMessages(messages || []) }, [messages]) useEffect(() => { diff --git a/packages/ui-date-input/src/index.ts b/packages/ui-date-input/src/index.ts index cbfea3e729..093de6030d 100644 --- a/packages/ui-date-input/src/index.ts +++ b/packages/ui-date-input/src/index.ts @@ -25,3 +25,4 @@ export { DateInput } from './DateInput' export { DateInput2 } from './DateInput2' export type { DateInputProps } from './DateInput/props' +export type { DateInput2Props } from './DateInput2/props'