This is an automated email from the ASF dual-hosted git repository.
mgubaidullin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
The following commit(s) were added to refs/heads/main by this push:
new dd09eacb Fix #1638 (#1639)
dd09eacb is described below
commit dd09eacbaf66f7cddca517ea1752d092139806eb
Author: Jamie <[email protected]>
AuthorDate: Tue Aug 18 15:56:59 2026 +0200
Fix #1638 (#1639)
Render validation errors with getError instead of getHelper.
getTextFieldPrefix, getTextFieldSuffix and getFormSelect passed a
react-hook-form FieldError object to getHelper, which renders its
argument directly as a React child. Since getHelper is declared to
take a string, the `as any` cast at the call sites hid the mismatch,
and any failing validation crashed the surrounding panel with
"Objects are not valid as a React child".
getError already exists for this and renders error.message.
Reachable via CreateProjectModal, which validates on every keystroke
and requires a name longer than 3 characters, so the dialog crashed
on the first character typed.
---
karavan-app/src/main/webui/src/ui/util/useFormUtil.tsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/karavan-app/src/main/webui/src/ui/util/useFormUtil.tsx
b/karavan-app/src/main/webui/src/ui/util/useFormUtil.tsx
index b81cee97..68c92064 100644
--- a/karavan-app/src/main/webui/src/ui/util/useFormUtil.tsx
+++ b/karavan-app/src/main/webui/src/ui/util/useFormUtil.tsx
@@ -232,7 +232,7 @@ export function useFormUtil(formContext:
UseFormReturn<any>) {
<Content className='text-field-prefix'
component={ContentVariants.p}>{prefix}</Content>
</TextInputGroupMain>
</TextInputGroup>
- {getHelper((errors as any)[fieldName])}
+ {getError((errors as any)[fieldName])}
</FormGroup>
)
}
@@ -262,7 +262,7 @@ export function useFormUtil(formContext:
UseFormReturn<any>) {
</TextInputGroup>
)}
/>
- {getHelper((errors as any)[fieldName])}
+ {getError((errors as any)[fieldName])}
</FormGroup>
)
}
@@ -287,7 +287,7 @@ export function useFormUtil(formContext:
UseFormReturn<any>) {
<FormSelectOption key={index} value={option[0]}
label={option[1]}/>
))}
</FormSelect>
- {getHelper((errors as any)[fieldName])}
+ {getError((errors as any)[fieldName])}
</FormGroup>
)
}