diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useFieldIsInvalid.ts b/invokeai/frontend/web/src/features/nodes/hooks/useFieldIsInvalid.ts index 108fa4b1ac..28943b5ffe 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useFieldIsInvalid.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useFieldIsInvalid.ts @@ -11,6 +11,7 @@ import { isStringFieldCollectionInputInstance, isStringFieldCollectionInputTemplate, } from 'features/nodes/types/field'; +import { isNil } from 'lodash-es'; import { useMemo } from 'react'; export const useFieldIsInvalid = (nodeId: string, fieldName: string) => { @@ -63,6 +64,16 @@ export const useFieldIsInvalid = (nodeId: string, fieldName: string) => { if (template.maxItems !== undefined && field.value.length > template.maxItems) { return true; } + if (field.value) { + for (const str of field.value) { + if (!isNil(template.maxLength) && str.length > template.maxLength) { + return true; + } + if (!isNil(template.minLength) && str.length < template.minLength) { + return true; + } + } + } } // Integer collections may have min or max item counts