@@ -26,35 +26,34 @@ class Fold extends Component {
26
26
this . foldVisible = false ;
27
27
28
28
React . Children . forEach ( nextProps . children , child => {
29
- if ( child ) {
30
- if ( child . props . attr ) {
31
- let plotProps ;
32
- if ( child . type . supplyPlotProps ) {
33
- plotProps = child . type . supplyPlotProps ( child . props , nextContext ) ;
34
- if ( child . type . modifyPlotProps ) {
35
- child . type . modifyPlotProps ( child . props , nextContext , plotProps ) ;
36
- }
37
- } else {
38
- plotProps = unpackPlotProps ( child . props , nextContext ) ;
39
- }
40
-
41
- if ( plotProps . isVisible ) {
42
- this . foldVisible = true ;
43
- return ;
29
+ if ( child && child . props . attr ) {
30
+ let plotProps ;
31
+ if ( child . type . supplyPlotProps ) {
32
+ plotProps = child . type . supplyPlotProps ( child . props , nextContext ) ;
33
+ if ( child . type . modifyPlotProps ) {
34
+ child . type . modifyPlotProps ( child . props , nextContext , plotProps ) ;
44
35
}
36
+ } else {
37
+ plotProps = unpackPlotProps ( child . props , nextContext ) ;
45
38
}
46
39
47
- // allow custom components in folds to automatically show up,
48
- // except for Folds of Folds, which should keep their visibility rules
49
- if (
50
- ! child . type . plotly_editor_traits ||
51
- ( child . type . plotly_editor_traits &&
52
- ! child . type . plotly_editor_traits . foldable )
53
- ) {
40
+ if ( plotProps . isVisible ) {
54
41
this . foldVisible = true ;
55
42
return ;
56
43
}
57
44
}
45
+
46
+ // allow custom components in folds to automatically show up,
47
+ // except for Folds of Folds, which should keep their visibility rules
48
+ if (
49
+ child &&
50
+ ( ! child . type . plotly_editor_traits ||
51
+ ( child . type . plotly_editor_traits &&
52
+ ! child . type . plotly_editor_traits . foldable ) )
53
+ ) {
54
+ this . foldVisible = true ;
55
+ return ;
56
+ }
58
57
} ) ;
59
58
}
60
59
0 commit comments