@@ -43,7 +43,7 @@ export const ArrayBase: ArrayInput = ({spec, name, arrayInput, input}) => {
4343
4444 if ( ! spec . items ?. required ) {
4545 if ( isArraySpec ( spec . items ) ) {
46- item = { OBJECT_ARRAY_FLAG : true , OBJECT_ARRAY_CNT : 0 } ;
46+ item = { [ OBJECT_ARRAY_FLAG ] : true , [ OBJECT_ARRAY_CNT ] : 0 } ;
4747 } else if ( isObjectSpec ( spec . items ) ) {
4848 item = { } ;
4949 }
@@ -86,6 +86,11 @@ export const ArrayBase: ArrayInput = ({spec, name, arrayInput, input}) => {
8686 [ input . onChange , input . name ] ,
8787 ) ;
8888
89+ const parentOnUnmount = React . useCallback (
90+ ( childName : string ) => input . onChange ( ( currentValue ) => currentValue , { [ childName ] : false } ) ,
91+ [ input . onChange ] ,
92+ ) ;
93+
8994 const items = React . useMemo (
9095 ( ) =>
9196 keys . map ( ( key , idx ) => {
@@ -99,13 +104,14 @@ export const ArrayBase: ArrayInput = ({spec, name, arrayInput, input}) => {
99104 < Controller
100105 initialValue = { input . value ?. [ `<${ key } >` ] }
101106 parentOnChange = { parentOnChange }
107+ parentOnUnmount = { parentOnUnmount }
102108 spec = { itemSpec }
103109 name = { `${ name } .<${ key } >` }
104110 key = { `${ name } .<${ key } >` }
105111 />
106112 ) ;
107113 } ) ,
108- [ keys . join ( '' ) , name , getItemSpec , parentOnChange , input . value ] ,
114+ [ keys . join ( '' ) , name , getItemSpec , parentOnChange , parentOnUnmount , input . value ] ,
109115 ) ;
110116
111117 if ( ! itemSpecCorrect ) {
0 commit comments