import type { UseFieldConfig } from 'react-final-form'; type KeptFieldConfig = Pick; type HoldConfig = KeptFieldConfig & { /** Seed an empty field's first render with its own `initialValue` or `defaultValue` */ seedsFirstRender?: boolean; }; interface KeepOptions extends Pick { /** The hook's own `isEqual` default, which the hold must agree with */ defaultIsEqual?: KeptFieldConfig['isEqual']; } type FieldHook = (name: string, config?: any) => unknown; /** * Works around react-final-form 7.0.1 losing a field's stored value when the * field mounts while final-form holds no state for it, as after every remount: * * - The first render is built from `initialValues`, and an array's shows no * items. The hold, registered during render and released at commit, lets * that render, and the children rendered with it, read the field state, * also when a concurrent render yields before the children. A render that * never commits releases it after a timeout, or, without a `window`, right * after the render. * - The mount effect writes `initialValues` back (#1095). The claim, * registered at commit and released right after that effect, prevents it. * It creates the field entry, so it carries the config final-form applies * only on create; `initialValue` or `defaultValue` would reseed, and holding * it longer would strand a hidden field's error. * * TODO: [PF-2522] drop the hold once react-final-form's first render reads the * stored value, the claim once upstream fixes #1095, and this file with both */ export declare const useKeptFieldState: (name: string, config?: HoldConfig, hookName?: string) => void; /** * Wraps a react-final-form field hook with `useKeptFieldState`, which must * hold before the hook's first render and claim after its mount effect */ export declare const keepFieldState: (useHook: Hook, hookName: string, { defaultIsEqual, seedsFirstRender }?: KeepOptions) => Hook; export {}; //# sourceMappingURL=keep-field-state.d.ts.map