@@ -2,12 +2,14 @@ import _ from "lodash";
2
2
import {
3
3
Comp ,
4
4
CompAction ,
5
+ CompActionTypes ,
5
6
CompParams ,
6
7
ConstructorToComp ,
7
8
ConstructorToNodeType ,
8
9
customAction ,
9
10
deferAction ,
10
11
isChildAction ,
12
+ isCustomAction ,
11
13
isMyCustomAction ,
12
14
MultiBaseComp ,
13
15
MultiCompConstructor ,
@@ -23,6 +25,7 @@ import { JSONValue } from "util/jsonTypes";
23
25
import { setFieldsNoTypeCheck } from "util/objectUtils" ;
24
26
import { map } from "./map" ;
25
27
import { paramsEqual , withParamsWithDefault } from "./withParams" ;
28
+ import { LazyCompReadyAction } from "../comps/lazyLoadComp/lazyLoadComp" ;
26
29
27
30
export const COMP_KEY = "__comp__" ;
28
31
export const MAP_KEY = "__map__" ;
@@ -160,8 +163,11 @@ export function withMultiContext<TCtor extends MultiCompConstructor>(VariantComp
160
163
} else if (
161
164
isChildAction ( action ) &&
162
165
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
+ )
165
171
) {
166
172
/**
167
173
* a virtual path is activated, should generate a new comp in __map__
@@ -171,17 +177,16 @@ export function withMultiContext<TCtor extends MultiCompConstructor>(VariantComp
171
177
const params = comp . cacheParamsMap . get ( key ) ;
172
178
if ( params ) {
173
179
const childComp = comp
174
- . getOriginalComp ( )
180
+ . getComp ( key ) !
175
181
. setParams ( params )
176
182
. changeDispatch ( wrapDispatch ( wrapDispatch ( comp . dispatch , MAP_KEY ) , key ) ) ;
177
183
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
+ ) ;
185
190
}
186
191
} else {
187
192
comp = super . reduce ( action ) ;
0 commit comments