@@ -90,6 +90,7 @@ class QueryRenderChild extends MarkdownRenderChild {
90
90
private readonly events : TasksEvents ;
91
91
92
92
private renderEventRef : EventRef | undefined ;
93
+ private reloadSearchResultsEventRef : EventRef | undefined ;
93
94
private queryReloadTimeout : NodeJS . Timeout | undefined ;
94
95
95
96
private isCacheChangedSinceLastRedraw = false ;
@@ -134,8 +135,10 @@ class QueryRenderChild extends MarkdownRenderChild {
134
135
135
136
// Process the current cache state:
136
137
this . events . triggerRequestCacheUpdate ( this . render . bind ( this ) ) ;
137
- // Listen to future cache changes:
138
+
139
+ // Listen to future changes:
138
140
this . renderEventRef = this . events . onCacheUpdate ( this . render . bind ( this ) ) ;
141
+ this . reloadSearchResultsEventRef = this . events . onReloadOpenSearchResults ( this . rereadQueryFromFile . bind ( this ) ) ;
139
142
140
143
this . reloadQueryAtMidnight ( ) ;
141
144
@@ -221,6 +224,10 @@ class QueryRenderChild extends MarkdownRenderChild {
221
224
this . events . off ( this . renderEventRef ) ;
222
225
}
223
226
227
+ if ( this . reloadSearchResultsEventRef !== undefined ) {
228
+ this . events . off ( this . reloadSearchResultsEventRef ) ;
229
+ }
230
+
224
231
if ( this . queryReloadTimeout !== undefined ) {
225
232
clearTimeout ( this . queryReloadTimeout ) ;
226
233
}
@@ -304,6 +311,13 @@ class QueryRenderChild extends MarkdownRenderChild {
304
311
305
312
this . containerEl . firstChild ?. replaceWith ( content ) ;
306
313
}
314
+
315
+ private rereadQueryFromFile ( ) {
316
+ this . queryResultsRenderer . rereadQueryFromFile ( ) ;
317
+ this . isCacheChangedSinceLastRedraw = true ;
318
+ // TODO Debounce this rendering
319
+ this . render ( { tasks : this . plugin . getTasks ( ) , state : this . plugin . getState ( ) } ) ;
320
+ }
307
321
}
308
322
309
323
function createEditTaskPencilClickHandler ( app : App ) : EditButtonClickHandler {
0 commit comments