Skip to content

Commit 32eca49

Browse files
committed
prevent render FormHelperText in SelectArrayInput
1 parent 676997b commit 32eca49

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ export const SelectArrayInput = (props: SelectArrayInputProps) => {
274274
),
275275
}
276276
: {};
277+
const renderHelperText =
278+
helperText !== false || ((isTouched || isSubmitted) && invalid);
277279

278280
return (
279281
<>
@@ -337,13 +339,17 @@ export const SelectArrayInput = (props: SelectArrayInputProps) => {
337339
>
338340
{finalChoices.map(renderMenuItem)}
339341
</Select>
340-
<FormHelperText error={fetchError || (isTouched && !!error)}>
341-
<InputHelperText
342-
touched={isTouched || isSubmitted || fetchError}
343-
error={error?.message || fetchError?.message}
344-
helperText={helperText}
345-
/>
346-
</FormHelperText>
342+
{renderHelperText ? (
343+
<FormHelperText
344+
error={fetchError || (isTouched && !!error)}
345+
>
346+
<InputHelperText
347+
touched={isTouched || isSubmitted || fetchError}
348+
error={error?.message || fetchError?.message}
349+
helperText={helperText}
350+
/>
351+
</FormHelperText>
352+
) : null}
347353
</StyledFormControl>
348354
{createElement}
349355
</>

0 commit comments

Comments
 (0)