Skip to content

Commit f079ece

Browse files
fix: array minRow validation should not show when non-required with no rows (#12037)
### What? UI only issue: An array row with `required: false` and `minRows: x` was displaying an error banner - this should only happen if one or more rows are present. The validation is not affected, the document still saved as expected, but the error should not be inaccurately displayed. ### Why? The logic for displaying the `minRow` validation error was `rows.length > minRows` and it needs to be `rows.length > 1 && rows.length > minRows` ### How? Updates the UI logic. Fixes #12010
1 parent b809c98 commit f079ece

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/ui/src/fields/Array/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export const ArrayFieldComponent: ArrayFieldClientComponent = (props) => {
201201
const fieldHasErrors = submitted && errorPaths.length > 0
202202

203203
const showRequired = (readOnly || disabled) && rows.length === 0
204-
const showMinRows = rows.length < minRows || (required && rows.length === 0)
204+
const showMinRows = (rows.length && rows.length < minRows) || (required && rows.length === 0)
205205

206206
return (
207207
<div

0 commit comments

Comments
 (0)