feat(frontend): updated `Records` to throw error when items is falsy

* This is very useful for debugging issues with forms.
pull/85/head
Samuel Rowe 3 years ago
parent 22c9ca3f6e
commit 968c1ac9bc

@ -80,6 +80,10 @@ const Records: FunctionComponent<IRecordsProps> = (
const formik = useFormikContext();
const items = lodash.get(formik.values, name);
if (!items) {
throw new Error(`"${name}" is falsy.`);
}
const handleNew = useCallback(() => {
formik.setFieldValue(`${name}[${items.length}]`, newValue);
}, [formik]);

Loading…
Cancel
Save