We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32d5e4d commit 0ef264aCopy full SHA for 0ef264a
CHANGELOG.md
@@ -1,3 +1,7 @@
1
+# 2.2.1 (25/06/2021)
2
+
3
+- Fix crash on undefined/null array when using useArrayField.
4
5
# 2.2.0 (9/05/2021)
6
7
- `innerRef` prop on `Field` and `FieldError`
src/hooks.ts
@@ -157,7 +157,7 @@ export function useArrayField<
157
useEffect(() => {
158
let id = parentForm.listen(name, () => {
159
let val = parentForm.values[name] as any;
160
- if (val.length !== oldLength.current) {
+ if (Array.isArray(val) && val.length !== oldLength.current) {
161
setRender((i) => i + 1);
162
oldLength.current = val.length;
163
}
0 commit comments