@@ -125,7 +125,11 @@ export function withMultiContext<TCtor extends MultiCompConstructor>(VariantComp
125
125
const params = this . cacheParamsMap . get ( key ) ;
126
126
if ( _ . isNil ( comp ) && ! _ . isNil ( params ) ) {
127
127
const mapComps = this . getMap ( ) ;
128
- if ( mapComps . hasOwnProperty ( key ) && ! paramsEqual ( params , mapComps [ key ] . getParams ( ) ) ) {
128
+ if (
129
+ Object . keys ( mapComps ) . length === Object . keys ( this . cacheParamsMap . getMap ( ) ) . length
130
+ && mapComps . hasOwnProperty ( key )
131
+ && ! paramsEqual ( params , mapComps [ key ] . getParams ( ) )
132
+ ) {
129
133
// refresh the item, since params changed
130
134
// this.dispatch(deferAction(wrapChildAction(MAP_KEY, MapCtor.batchDeleteAction([key]))));
131
135
this . dispatch ( wrapChildAction ( MAP_KEY , MapCtor . batchDeleteAction ( [ key ] ) ) ) ;
@@ -177,16 +181,18 @@ export function withMultiContext<TCtor extends MultiCompConstructor>(VariantComp
177
181
const params = comp . cacheParamsMap . get ( key ) ;
178
182
if ( params ) {
179
183
const childComp = comp
180
- . getComp ( key ) !
184
+ . getOriginalComp ( )
181
185
. setParams ( params )
182
186
. changeDispatch ( wrapDispatch ( wrapDispatch ( comp . dispatch , MAP_KEY ) , key ) ) ;
183
187
const newChildComp = childComp . reduce ( childAction ) ;
184
188
185
- const comps = { [ key ] : newChildComp } ;
186
- comp = comp . setChild (
187
- MAP_KEY ,
188
- comp . children [ MAP_KEY ] . reduce ( MapCtor . batchSetCompAction ( comps ) )
189
- ) ;
189
+ if ( childComp !== newChildComp ) {
190
+ const comps = { [ key ] : newChildComp } ;
191
+ comp = comp . setChild (
192
+ MAP_KEY ,
193
+ comp . children [ MAP_KEY ] . reduce ( MapCtor . batchSetCompAction ( comps ) )
194
+ ) ;
195
+ }
190
196
}
191
197
} else {
192
198
comp = super . reduce ( action ) ;
0 commit comments