@@ -115,36 +115,37 @@ export class SharedNotebookRenderStrategy implements ExpandableNodeRenderStrateg
115
115
}
116
116
117
117
private onExpand ( ) {
118
- if ( this . isExpandable ( ) ) {
119
- if ( ! this . notebook . apiProperties && ! this . notebook . startedLoading ) {
120
- // This notebook was made known to us by GetRecentNotebooks, but we haven't
121
- // fetched any metadata or children info
122
- this . notebook . startedLoading = true ;
123
- const depth = this . globals . notebookExpandDepth || 5 ;
124
- this . globals . oneNoteDataProvider . getSpNotebookProperties ( this . notebook , depth , true ) . then ( ( apiProperties ) => {
125
- if ( ! apiProperties ) {
126
- this . notebook . apiHttpErrorCode = 404 ;
127
- return ;
128
- }
129
-
130
- this . notebook . apiProperties = apiProperties ;
131
-
132
- if ( this . globals . notebookListUpdater ) {
133
- this . globals . notebookListUpdater . updateNotebookList ( [ this . notebook ] ) ;
134
- }
135
- } ) . catch ( ( xhrs : XMLHttpRequest [ ] ) => {
136
- let max = 0 ;
137
- for ( let i = 0 ; i < xhrs . length ; i ++ ) {
138
- max = Math . max ( xhrs [ i ] . status , max ) ;
139
- }
140
- this . notebook . apiHttpErrorCode = max ;
141
- } ) . then ( ( ) => {
142
- let { onSharedNotebookInfoReturned } = this . globals . callbacks ;
143
- if ( ! ! onSharedNotebookInfoReturned ) {
144
- onSharedNotebookInfoReturned ( this . notebook ) ;
145
- }
146
- } ) ;
147
- }
118
+ // Check if the picker is expandable
119
+ if ( ( this . globals . callbacks . onSectionSelected || ! ! this . globals . callbacks . onPageSelected ) &&
120
+ ! this . notebook . apiProperties && ! this . notebook . startedLoading && this . globals . oneNoteDataProvider ) {
121
+ // This notebook was made known to us by GetRecentNotebooks, but we haven't
122
+ // fetched any metadata or children info
123
+ this . notebook . startedLoading = true ;
124
+ const depth = this . globals . notebookExpandDepth || 5 ;
125
+
126
+ this . globals . oneNoteDataProvider . getSpNotebookProperties ( this . notebook , depth , true ) . then ( ( apiProperties ) => {
127
+ if ( ! apiProperties ) {
128
+ this . notebook . apiHttpErrorCode = 404 ;
129
+ return ;
130
+ }
131
+
132
+ this . notebook . apiProperties = apiProperties ;
133
+
134
+ if ( this . globals . notebookListUpdater ) {
135
+ this . globals . notebookListUpdater . updateNotebookList ( [ this . notebook ] ) ;
136
+ }
137
+ } ) . catch ( ( xhrs : XMLHttpRequest [ ] ) => {
138
+ let max = 0 ;
139
+ for ( let i = 0 ; i < xhrs . length ; i ++ ) {
140
+ max = Math . max ( xhrs [ i ] . status , max ) ;
141
+ }
142
+ this . notebook . apiHttpErrorCode = max ;
143
+ } ) . then ( ( ) => {
144
+ let { onSharedNotebookInfoReturned } = this . globals . callbacks ;
145
+ if ( ! ! onSharedNotebookInfoReturned ) {
146
+ onSharedNotebookInfoReturned ( this . notebook ) ;
147
+ }
148
+ } ) ;
148
149
}
149
150
}
150
151
@@ -153,8 +154,4 @@ export class SharedNotebookRenderStrategy implements ExpandableNodeRenderStrateg
153
154
let split = url . split ( '/' ) ;
154
155
return split . slice ( 3 , - 1 ) . map ( decodeURIComponent ) . join ( '/' ) ;
155
156
}
156
-
157
- private isExpandable ( ) : boolean {
158
- return ! ! this . globals . callbacks . onSectionSelected || ! ! this . globals . callbacks . onPageSelected ;
159
- }
160
157
}
0 commit comments