1- import { App , Plugin } from "obsidian" ;
1+ import { App , CachedMetadata , Plugin } from "obsidian" ;
22import { MarkdownPostProcessorContext , MarkdownView , Editor } from "obsidian" ;
33import { TFile , TFolder , normalizePath } from "obsidian" ;
44import { render , renderErrorMessage } from "./rendering" ;
@@ -181,7 +181,7 @@ export default class Tracker extends Plugin {
181181 const loopFilePromises = files . map ( async ( file ) => {
182182 // console.log(file.basename);
183183 // Get fileCache and content
184- let fileCache = null ;
184+ let fileCache : CachedMetadata = null ;
185185 let needFileCache = renderInfo . queries . some ( ( q ) => {
186186 let type = q . getType ( ) ;
187187 if (
@@ -197,7 +197,7 @@ export default class Tracker extends Plugin {
197197 fileCache = this . app . metadataCache . getFileCache ( file ) ;
198198 }
199199
200- let content = null ;
200+ let content : string = null ;
201201 let needContent = renderInfo . queries . some ( ( q ) => {
202202 let type = q . getType ( ) ;
203203 if (
@@ -282,10 +282,10 @@ export default class Tracker extends Plugin {
282282 // console.log(xValueMap);
283283
284284 // Loop over queries
285- for ( let query of renderInfo . queries ) {
286- if ( query . getType ( ) === SearchType . Table ) continue ;
287- if ( query . usedAsXDataset ) continue ;
288-
285+ let yDatasetQueries = renderInfo . queries . filter ( ( q ) => {
286+ return q . getType ( ) !== SearchType . Table && ! q . usedAsXDataset ;
287+ } ) ;
288+ const loopQueryPromises = yDatasetQueries . map ( async ( query ) => {
289289 // Get xValue from file if xDataset assigned
290290 // if (renderInfo.xDataset !== null)
291291 // let xDatasetId = renderInfo.xDataset;
@@ -360,7 +360,8 @@ export default class Tracker extends Plugin {
360360 xValueMap
361361 ) ;
362362 } // search dvField
363- } // end loof of files
363+ } ) ;
364+ await Promise . all ( loopQueryPromises ) ;
364365 } ) ;
365366 await Promise . all ( loopFilePromises ) ;
366367
0 commit comments