1import React, { useCallback } from 'react';
2import { Form } from 'react-final-form';
3import arrayMutators from 'final-form-arrays';
4import { noop } from 'lodash';
6import ValuesHandler from './ValuesHandler';
7import ValidationPauser from './ValidationPauser';
10 * BridgeForm adds nice-to-haves for every form in bridge.
11 * + afterSubmit callback for redirects
12 * + default onSubmit to noop so react-final-form doesn't throw
13 * + pauses validation when the form is unmounted
14 * + `onValues` handler for reactive changes
15 * + automatically includes array and field data mutators
17export default function BridgeForm({
24 const _onSubmit = useCallback(
26 const errors = await onSubmit(...args);
33 [afterSubmit, onSubmit]
37 <Form mutators={{ ...arrayMutators }} onSubmit={_onSubmit} {...rest}>
40 style={formProps?.style || { display: 'contents' }}
41 onSubmit={formProps.handleSubmit}>
44 {onValues && <ValuesHandler {...formProps} 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