Skip to content

Build your personal knowledge base with Trilium Notes

feat(tasks): implement basic refresh support

Elian Doran62c96fc95ec2
diff --git a/src/public/app/services/load_results.ts b/src/public/app/services/load_results.ts
index e91dfde86c..25f3b30ec3 100644
--- a/src/public/app/services/load_results.ts
+++ b/src/public/app/services/load_results.ts
@@ -183,6 +183,14 @@ export default class LoadResults {
return this.contentNoteIdToComponentId.find((l) => l.noteId === noteId && l.componentId !== componentId);
}
+ isTaskListReloaded(parentNoteId: string) {
+ if (!parentNoteId) {
+ return false;
+ }
+
+ return !!this.taskRows.find((tr) => tr.parentNoteId === parentNoteId);
+ }
+
addOption(name: string) {
this.optionNames.push(name);
}
diff --git a/src/public/app/widgets/type_widgets/task_list.ts b/src/public/app/widgets/type_widgets/task_list.ts
index 037ec57391..6c4f1aedaf 100644
--- a/src/public/app/widgets/type_widgets/task_list.ts
+++ b/src/public/app/widgets/type_widgets/task_list.ts
@@ -121,7 +121,9 @@ export default class TaskListWidget extends TypeWidget {
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
- console.log("Update", loadResults);
+ if (this.noteId && loadResults.isTaskListReloaded(this.noteId)) {
+ this.refresh();
+ }
}
}