Skip to content

Commit

Permalink
comment: Remove some TODOs and tidy up comments
Browse files Browse the repository at this point in the history
  • Loading branch information
claremacrae committed Jan 20, 2025
1 parent 77e78cc commit 972e8f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/Renderer/QueryRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -127,7 +125,6 @@ class QueryRenderChild extends MarkdownRenderChild {
return;
}

// TODO We need to debounce this.
this.handleMetadataOrFilePathChange(filePath, fileCache);
}),
);
Expand Down
14 changes: 6 additions & 8 deletions src/Renderer/QueryResultsRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 972e8f6

Please sign in to comment.