@@ -251,7 +251,20 @@ export class HtmlQueryResultsRenderer {
251251 */
252252 private async addTreeTaskList ( listItems : ListItem [ ] ) : Promise < void > {
253253 for ( const [ listItemIndex , listItem ] of listItems . entries ( ) ) {
254- await this . addTaskOrListItemAndChildren ( listItem , listItemIndex , listItems ) ;
254+ if ( this . alreadyRendered ( listItem ) ) {
255+ continue ;
256+ }
257+
258+ if ( this . willBeRenderedLater ( listItem , listItems ) ) {
259+ continue ;
260+ }
261+
262+ await this . createTaskOrListItem ( listItem , listItemIndex ) ;
263+ this . renderedListItems . add ( listItem ) ;
264+
265+ for ( const childTask of listItem . children ) {
266+ this . renderedListItems . add ( childTask ) ;
267+ }
255268 }
256269 }
257270
@@ -276,23 +289,6 @@ export class HtmlQueryResultsRenderer {
276289 return this . renderedListItems . has ( listItem ) ;
277290 }
278291
279- private async addTaskOrListItemAndChildren ( listItem : ListItem , taskIndex : number , listItems : ListItem [ ] ) {
280- if ( this . alreadyRendered ( listItem ) ) {
281- return ;
282- }
283-
284- if ( this . willBeRenderedLater ( listItem , listItems ) ) {
285- return ;
286- }
287-
288- await this . createTaskOrListItem ( listItem , taskIndex ) ;
289- this . renderedListItems . add ( listItem ) ;
290-
291- for ( const childTask of listItem . children ) {
292- this . renderedListItems . add ( childTask ) ;
293- }
294- }
295-
296292 private async createTaskOrListItem ( listItem : ListItem , taskIndex : number ) : Promise < void > {
297293 if ( listItem instanceof Task ) {
298294 await this . addTask ( listItem , taskIndex , listItem . children ) ;
0 commit comments