mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 02:28:57 +01:00
fix(react/dialog): react to adding new bulk actions
This commit is contained in:
parent
05f1ae01f3
commit
3dd6b05d2e
@ -38,13 +38,16 @@ function BulkActionComponent({ selectedOrActiveNoteIds, bulkActionNote }: BulkAc
|
|||||||
}).then(({ affectedNoteCount }) => setAffectedNoteCount(affectedNoteCount));
|
}).then(({ affectedNoteCount }) => setAffectedNoteCount(affectedNoteCount));
|
||||||
}, [ selectedOrActiveNoteIds, includeDescendants ]);
|
}, [ selectedOrActiveNoteIds, includeDescendants ]);
|
||||||
|
|
||||||
// Refresh is forced by the entities reloaded event outside React.
|
function refreshExistingActions() {
|
||||||
useEffect(() => {
|
setExistingActions(bulk_action.parseActions(bulkActionNote!));
|
||||||
setExistingActions(bulk_action.parseActions(bulkActionNote));
|
}
|
||||||
}, []);
|
|
||||||
|
|
||||||
useTriliumEvent("entitiesReloaded", () => {
|
useEffect(() => refreshExistingActions(), []);
|
||||||
console.log("Got entities reloaded.");
|
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
|
||||||
|
if (loadResults.getAttributeRows().find((row) =>
|
||||||
|
row.type === "label" && row.name === "action" && row.noteId === "_bulkAction")) {
|
||||||
|
refreshExistingActions();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return ( selectedOrActiveNoteIds &&
|
return ( selectedOrActiveNoteIds &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user