1import React, { useCallback } from 'react';
2import { Form } from 'react-final-form';
3import setFieldData from 'final-form-set-field-data';
4import arrayMutators from 'final-form-arrays';
5import { noop } from 'lodash';
7import ValuesHandler from './ValuesHandler';
8import ValidationPauser from './ValidationPauser';
9import WarningEngine from './WarningEngine';
12 * BridgeForm adds nice-to-haves for every form in bridge.
13 * + afterSubmit callback for redirects
14 * + default onSubmit to noop so react-final-form doesn't throw
15 * + pauses validation when the form is unmounted
16 * + `onValues` handler for reactive changes
17 * + automatically includes array and field data mutators
19export default function BridgeForm({
27 const _onSubmit = useCallback(
29 const errors = await onSubmit(...args);
36 [afterSubmit, onSubmit]
41 mutators={{ setFieldData, ...arrayMutators }}
46 {warnings && <WarningEngine warnings={warnings} />}
49 {onValues && <ValuesHandler onValues={onValues} />}
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list