From 972e8f6895e494fad25f8dbbfd1b6464b5333a8f Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Mon, 20 Jan 2025 19:52:14 +0000 Subject: [PATCH] comment: Remove some TODOs and tidy up comments --- src/Renderer/QueryRenderer.ts | 3 --- src/Renderer/QueryResultsRenderer.ts | 14 ++++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Renderer/QueryRenderer.ts b/src/Renderer/QueryRenderer.ts index c1317a6941..c9b56e104d 100644 --- a/src/Renderer/QueryRenderer.ts +++ b/src/Renderer/QueryRenderer.ts @@ -42,8 +42,6 @@ export class QueryRenderer { // not yet available, so empty. // - Multi-line properties are supported, but they cannot contain // continuation lines. - // TODO Some of this the following code will need to be repeated in metadataCache.on('changed') - // so need to separate out the logic somehow. const app = this.app; const filePath = context.sourcePath; const tFile = app.vault.getAbstractFileByPath(filePath); @@ -127,7 +125,6 @@ class QueryRenderChild extends MarkdownRenderChild { return; } - // TODO We need to debounce this. this.handleMetadataOrFilePathChange(filePath, fileCache); }), ); diff --git a/src/Renderer/QueryResultsRenderer.ts b/src/Renderer/QueryResultsRenderer.ts index 5ea9624e01..148ef18aa1 100644 --- a/src/Renderer/QueryResultsRenderer.ts +++ b/src/Renderer/QueryResultsRenderer.ts @@ -42,7 +42,8 @@ export class QueryResultsRenderer { public readonly source: string; // The path of the file that contains the instruction block, and cached data from that file. - // This is updated when the query file's frontmatter is modified. + // This can be updated when the query file's frontmatter is modified. + // It is up to the caller to determine when to do this though. private _tasksFile: TasksFile; public query: IQuery; @@ -92,16 +93,13 @@ export class QueryResultsRenderer { return this._tasksFile; } + /** + * Reload the query with new file information, such as to update query placeholders. + * @param newFile + */ public setTasksFile(newFile: TasksFile) { - // For now, this always updates the query when the TasksFile changes. - // TODO For efficiency, only update if either the path or raw frontmatter has been changed. - this._tasksFile = newFile; - // Recreate the query, as placeholders and file properties may have changed. this.query = this.makeQueryFromSourceAndTasksFile(); - - // It is up to the caller to ensure that any search results are re-rendered. - // TODO Somehow provide information back to the caller to say whether query has been changed. } public get filePath(): string | undefined {