From 62c96fc95ec245f33e3429d8a3cc72e413cbbe87 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 19 Feb 2025 22:34:52 +0200 Subject: [PATCH] feat(tasks): implement basic refresh support --- src/public/app/services/load_results.ts | 8 ++++++++ src/public/app/widgets/type_widgets/task_list.ts | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/public/app/services/load_results.ts b/src/public/app/services/load_results.ts index e91dfde86..25f3b30ec 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 037ec5739..6c4f1aeda 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(); + } } }