File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
packages/form-js-viewer/src/render/components Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { FormContext, FormRenderContext } from '../context';
7
7
8
8
import {
9
9
useCondition ,
10
+ useDeepCompareMemoize ,
10
11
useReadonly ,
11
12
useService
12
13
} from '../hooks' ;
@@ -19,7 +20,7 @@ const noop = () => false;
19
20
export function FormField ( props ) {
20
21
const {
21
22
field,
22
- indexes,
23
+ indexes : _indexes ,
23
24
onChange
24
25
} = props ;
25
26
@@ -44,6 +45,8 @@ export function FormField(props) {
44
45
45
46
const { formId } = useContext ( FormContext ) ;
46
47
48
+ const indexes = useDeepCompareMemoize ( _indexes || { } ) ;
49
+
47
50
// track whether we should trigger initial validation on certain actions, e.g. field blur
48
51
// disabled straight away, if viewerCommands are not available
49
52
const [ initialValidationTrigger , setInitialValidationTrigger ] = useState ( ! ! viewerCommands ) ;
@@ -134,7 +137,7 @@ export function FormField(props) {
134
137
}
135
138
136
139
const domId = `${ prefixId ( field . id , formId , indexes ) } ` ;
137
- const fieldErrors = get ( errors , [ field . id , ...Object . values ( indexes || { } ) ] ) || [ ] ;
140
+ const fieldErrors = get ( errors , [ field . id , ...Object . values ( indexes ) ] ) || [ ] ;
138
141
139
142
const formFieldElement = (
140
143
< FormFieldComponent
You can’t perform that action at this time.
0 commit comments