@@ -11,6 +11,7 @@ import {
11
11
equals ,
12
12
isEmpty ,
13
13
isNil ,
14
+ has ,
14
15
keys ,
15
16
map ,
16
17
mergeRight ,
@@ -71,6 +72,15 @@ function createElement(element, props, extraProps, children) {
71
72
return React . createElement ( element , allProps , children ) ;
72
73
}
73
74
75
+ function isDryComponent ( obj ) {
76
+ return (
77
+ type ( obj ) === 'Object' &&
78
+ has ( 'type' , obj ) &&
79
+ has ( 'namespace' , obj ) &&
80
+ has ( 'props' , obj )
81
+ ) ;
82
+ }
83
+
74
84
const TreeContainer = memo ( props => (
75
85
< DashContext . Consumer >
76
86
{ context => (
@@ -212,28 +222,33 @@ class BaseTreeContainer extends Component {
212
222
if ( childrenProp . startsWith ( '[]' ) ) {
213
223
const frontPath = path [ 0 ] . slice ( 2 ) ;
214
224
node = _dashprivate_layout . props [ frontPath ] ;
215
- if ( ! node ) {
225
+ if ( node === undefined ) {
216
226
return ;
217
227
}
218
228
nodeValue = node . map ( ( n , i ) => ( {
219
229
...n ,
220
- [ path [ 1 ] ] : this . createContainer (
221
- this . props ,
222
- n [ path [ 1 ] ] ,
223
- concat ( this . props . _dashprivate_path , [
224
- 'props' ,
225
- frontPath ,
226
- i ,
227
- path [ 1 ]
228
- ] )
229
- )
230
+ [ path [ 1 ] ] : isDryComponent ( n [ path [ 1 ] ] )
231
+ ? this . createContainer (
232
+ this . props ,
233
+ n [ path [ 1 ] ] ,
234
+ concat ( this . props . _dashprivate_path , [
235
+ 'props' ,
236
+ frontPath ,
237
+ i ,
238
+ path [ 1 ]
239
+ ] )
240
+ )
241
+ : n
230
242
} ) ) ;
231
243
path = [ frontPath ] ;
232
244
} else {
233
245
node = rpath ( path , _dashprivate_layout . props ) ;
234
- if ( ! node ) {
246
+ if ( node === undefined ) {
235
247
return ;
236
248
}
249
+ if ( ! isDryComponent ( node ) ) {
250
+ return node ;
251
+ }
237
252
nodeValue = this . createContainer (
238
253
this . props ,
239
254
node ,
@@ -247,23 +262,27 @@ class BaseTreeContainer extends Component {
247
262
return assocPath ( path , nodeValue ) ;
248
263
}
249
264
const node = _dashprivate_layout . props [ childrenProp ] ;
250
- if ( node ) {
265
+ if ( node !== undefined ) {
251
266
if ( Array . isArray ( node ) ) {
252
267
return assoc (
253
268
childrenProp ,
254
269
node . map ( ( n , i ) =>
255
- this . createContainer (
256
- this . props ,
257
- n ,
258
- concat ( this . props . _dashprivate_path , [
259
- 'props' ,
260
- childrenProp ,
261
- i
262
- ] )
263
- )
270
+ isDryComponent ( n )
271
+ ? this . createContainer (
272
+ this . props ,
273
+ n ,
274
+ concat (
275
+ this . props . _dashprivate_path ,
276
+ [ 'props' , childrenProp , i ]
277
+ )
278
+ )
279
+ : n
264
280
)
265
281
) ;
266
282
}
283
+ if ( ! isDryComponent ( node ) ) {
284
+ return ;
285
+ }
267
286
return assoc (
268
287
childrenProp ,
269
288
this . createContainer (
@@ -277,7 +296,7 @@ class BaseTreeContainer extends Component {
277
296
) ;
278
297
}
279
298
} )
280
- . filter ( e => e )
299
+ . filter ( e => e !== undefined )
281
300
) ( _dashprivate_layout . props ) ;
282
301
283
302
if ( type ( props . id ) === 'Object' ) {
0 commit comments