@@ -2,12 +2,14 @@ import _ from "lodash";
22import {
33 Comp ,
44 CompAction ,
5+ CompActionTypes ,
56 CompParams ,
67 ConstructorToComp ,
78 ConstructorToNodeType ,
89 customAction ,
910 deferAction ,
1011 isChildAction ,
12+ isCustomAction ,
1113 isMyCustomAction ,
1214 MultiBaseComp ,
1315 MultiCompConstructor ,
@@ -23,6 +25,7 @@ import { JSONValue } from "util/jsonTypes";
2325import { setFieldsNoTypeCheck } from "util/objectUtils" ;
2426import { map } from "./map" ;
2527import { paramsEqual , withParamsWithDefault } from "./withParams" ;
28+ import { LazyCompReadyAction } from "../comps/lazyLoadComp/lazyLoadComp" ;
2629
2730export const COMP_KEY = "__comp__" ;
2831export const MAP_KEY = "__map__" ;
@@ -160,8 +163,11 @@ export function withMultiContext<TCtor extends MultiCompConstructor>(VariantComp
160163 } else if (
161164 isChildAction ( action ) &&
162165 action . path [ 0 ] === MAP_KEY &&
163- ! _ . isNil ( action . path [ 1 ] ) &&
164- ! thisCompMap . hasOwnProperty ( action . path [ 1 ] )
166+ ! _ . isNil ( action . path [ 1 ] )
167+ && (
168+ ! thisCompMap . hasOwnProperty ( action . path [ 1 ] )
169+ || isCustomAction < LazyCompReadyAction > ( action , "LazyCompReady" )
170+ )
165171 ) {
166172 /**
167173 * a virtual path is activated, should generate a new comp in __map__
@@ -171,17 +177,16 @@ export function withMultiContext<TCtor extends MultiCompConstructor>(VariantComp
171177 const params = comp . cacheParamsMap . get ( key ) ;
172178 if ( params ) {
173179 const childComp = comp
174- . getOriginalComp ( )
180+ . getComp ( key ) !
175181 . setParams ( params )
176182 . changeDispatch ( wrapDispatch ( wrapDispatch ( comp . dispatch , MAP_KEY ) , key ) ) ;
177183 const newChildComp = childComp . reduce ( childAction ) ;
178- if ( childComp !== newChildComp ) {
179- const comps = { [ key ] : newChildComp } ;
180- comp = comp . setChild (
181- MAP_KEY ,
182- comp . children [ MAP_KEY ] . reduce ( MapCtor . batchSetCompAction ( comps ) )
183- ) ;
184- }
184+
185+ const comps = { [ key ] : newChildComp } ;
186+ comp = comp . setChild (
187+ MAP_KEY ,
188+ comp . children [ MAP_KEY ] . reduce ( MapCtor . batchSetCompAction ( comps ) )
189+ ) ;
185190 }
186191 } else {
187192 comp = super . reduce ( action ) ;
0 commit comments