11import React from 'react' ;
22
3+ import get from 'lodash/get' ;
34import isFunction from 'lodash/isFunction' ;
45import isString from 'lodash/isString' ;
5- import get from 'lodash/get' ;
66import { isValidElementType } from 'react-is' ;
77import type { MonacoEditorProps } from 'react-monaco-editor/lib/types' ;
88
@@ -30,6 +30,7 @@ export interface DynamicFieldProps {
3030 search ?: string | ( ( spec : Spec , input : FieldValue , name : string ) => boolean ) ;
3131 generateRandomValue ?: ( spec : StringSpec ) => string ;
3232 withoutInsertFFDebounce ?: boolean ;
33+ destroyOnUnregister ?: boolean ;
3334 mutators ?: DynamicFormMutators ;
3435 __mirror ?: WonderMirror ;
3536}
@@ -42,13 +43,14 @@ export const DynamicField: React.FC<DynamicFieldProps> = ({
4243 generateRandomValue,
4344 search,
4445 withoutInsertFFDebounce,
46+ destroyOnUnregister = true ,
4547 mutators : externalMutators ,
4648 __mirror,
4749} ) => {
4850 const DynamicFormsCtx = useCreateContext ( ) ;
4951 const SearchContext = useCreateSearchContext ( ) ;
5052 const { tools, store} = useStore ( name ) ;
51- const watcher = useIntegrationFF ( store , withoutInsertFFDebounce ) ;
53+ const watcher = useIntegrationFF ( store , withoutInsertFFDebounce , destroyOnUnregister ) ;
5254 const { mutatorsStore, mutateDFState} = useMutators ( externalMutators ) ;
5355 const { store : searchStore , setField, removeField, isHiddenField} = useSearchStore ( ) ;
5456
0 commit comments