feat(tasks): implement basic refresh support

This commit is contained in:
Elian Doran 2025-02-19 22:34:52 +02:00
parent c0d3e8d834
commit 62c96fc95e
No known key found for this signature in database
2 changed files with 11 additions and 1 deletions

View File

@ -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);
}

View File

@ -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();
}
}
}