@@ -174,23 +174,22 @@ class QueryRenderChild extends MarkdownRenderChild {
174
174
return ;
175
175
}
176
176
177
- this . observer = new IntersectionObserver ( ( entries ) => {
177
+ this . observer = new IntersectionObserver ( ( [ entry ] ) => {
178
178
if ( ! this . containerEl . isShown ( ) ) {
179
179
return ;
180
180
}
181
181
182
- for ( const entry of entries ) {
183
- // entry describes a single visibility change for the specific element we are observing.
184
- if ( entry . isIntersecting ) {
185
- this . queryResultsRenderer . query . debug (
186
- `[render][observer] Became visible, isCacheChangedSinceLastRedraw:${ this . isCacheChangedSinceLastRedraw } ` ,
187
- ) ;
188
- if ( this . isCacheChangedSinceLastRedraw ) {
189
- this . queryResultsRenderer . query . debug ( '[render][observer] ... updating search results' ) ;
190
- this . render ( { tasks : this . plugin . getTasks ( ) , state : this . plugin . getState ( ) } )
191
- . then ( )
192
- . catch ( ( e ) => console . error ( e ) ) ;
193
- }
182
+ // entry describes a single visibility change for the specific element we are observing.
183
+ // It is safe to assume `entry.target === this.containerEl` here.
184
+ if ( entry . isIntersecting ) {
185
+ this . queryResultsRenderer . query . debug (
186
+ `[render][observer] Became visible, isCacheChangedSinceLastRedraw:${ this . isCacheChangedSinceLastRedraw } ` ,
187
+ ) ;
188
+ if ( this . isCacheChangedSinceLastRedraw ) {
189
+ this . queryResultsRenderer . query . debug ( '[render][observer] ... updating search results' ) ;
190
+ this . render ( { tasks : this . plugin . getTasks ( ) , state : this . plugin . getState ( ) } )
191
+ . then ( )
192
+ . catch ( ( e ) => console . error ( e ) ) ;
194
193
}
195
194
}
196
195
} ) ;
0 commit comments