@@ -54,7 +54,7 @@ export class NotebookRenderStrategy implements ExpandableNodeRenderStrategy {
54
54
] ;
55
55
}
56
56
57
- if ( this . notebook . needsToFetchChildren ) {
57
+ if ( ! this . notebook . sections && ! this . notebook . sectionGroups ) {
58
58
return [
59
59
< li className = 'progress-row' >
60
60
< SpinnerIconSvg />
@@ -76,6 +76,10 @@ export class NotebookRenderStrategy implements ExpandableNodeRenderStrategy {
76
76
</ CreateNewSectionNode > ] :
77
77
[ ] ;
78
78
79
+ if ( ! this . notebook . sections || ! this . notebook . sectionGroups ) {
80
+ return [ ...createNewSection ]
81
+ }
82
+
79
83
const setsize = this . notebook . sections . length + this . notebook . sectionGroups . length ;
80
84
81
85
const sectionGroupRenderStrategies = this . notebook . sectionGroups . map ( sectionGroup => new SectionGroupRenderStrategy ( sectionGroup , this . globals ) ) ;
@@ -85,7 +89,7 @@ export class NotebookRenderStrategy implements ExpandableNodeRenderStrategy {
85
89
expanded = { renderStrategy . isExpanded ( ) } node = { renderStrategy } globals = { this . globals }
86
90
treeViewId = { Constants . TreeView . id } key = { renderStrategy . getId ( ) }
87
91
id = { renderStrategy . getId ( ) } level = { childrenLevel } ariaSelected = { renderStrategy . isAriaSelected ( ) } selected = { renderStrategy . isSelected ( ) }
88
- setsize = { setsize } posinset = { this . notebook . sections . length + i + 1 } /> :
92
+ setsize = { setsize } posinset = { this . notebook . sections ? this . notebook . sections . length + i + 1 : undefined } /> :
89
93
< LeafNode node = { renderStrategy } treeViewId = { Constants . TreeView . id } key = { renderStrategy . getId ( ) } globals = { this . globals }
90
94
id = { renderStrategy . getId ( ) } level = { childrenLevel } ariaSelected = { renderStrategy . isAriaSelected ( ) } /> ) ;
91
95
@@ -143,7 +147,7 @@ export class NotebookRenderStrategy implements ExpandableNodeRenderStrategy {
143
147
}
144
148
145
149
private onExpand ( ) {
146
- if ( this . notebook . needsToFetchChildren && this . notebook . apiUrl && this . globals . oneNoteDataProvider ) {
150
+ if ( ! this . notebook . sections && ! this . notebook . sectionGroups && this . notebook . apiUrl && this . globals . oneNoteDataProvider ) {
147
151
this . globals . oneNoteDataProvider . getNotebookBySelfUrl ( this . notebook . apiUrl , 5 ) . then ( ( notebook ) => {
148
152
this . notebook . sections = notebook . sections
149
153
this . notebook . sectionGroups = notebook . sectionGroups
@@ -154,7 +158,6 @@ export class NotebookRenderStrategy implements ExpandableNodeRenderStrategy {
154
158
this . notebook . apiHttpErrorMessage = Strings . getError ( apiError . statusCode ) ;
155
159
}
156
160
} ) . then ( ( ) => {
157
- this . notebook . needsToFetchChildren = false ;
158
161
if ( this . globals . callbacks . onNotebookInfoReturned ) {
159
162
this . globals . callbacks . onNotebookInfoReturned ( this . notebook ) ;
160
163
}
0 commit comments