Skip to content

Commit abb5f92

Browse files
committed
prevent render InputHelperText in SelectInput
1 parent 32eca49 commit abb5f92

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

packages/ra-ui-materialui/src/input/SelectInput.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ export const SelectInput = (props: SelectInputProps) => {
296296
);
297297
}
298298

299+
const renderHelperText =
300+
helperText !== false || ((isTouched || isSubmitted) && invalid);
301+
299302
return (
300303
<>
301304
<StyledResettableTextField
@@ -318,11 +321,13 @@ export const SelectInput = (props: SelectInputProps) => {
318321
clearAlwaysVisible
319322
error={!!fetchError || ((isTouched || isSubmitted) && invalid)}
320323
helperText={
321-
<InputHelperText
322-
touched={isTouched || isSubmitted || fetchError}
323-
error={error?.message || fetchError?.message}
324-
helperText={helperText}
325-
/>
324+
renderHelperText ? (
325+
<InputHelperText
326+
touched={isTouched || isSubmitted || fetchError}
327+
error={error?.message || fetchError?.message}
328+
helperText={helperText}
329+
/>
330+
) : null
326331
}
327332
margin={margin}
328333
{...sanitizeRestProps(rest)}

0 commit comments

Comments
 (0)