mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 18:18:55 +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));
|
||||
}, [ selectedOrActiveNoteIds, includeDescendants ]);
|
||||
|
||||
// Refresh is forced by the entities reloaded event outside React.
|
||||
useEffect(() => {
|
||||
setExistingActions(bulk_action.parseActions(bulkActionNote));
|
||||
}, []);
|
||||
function refreshExistingActions() {
|
||||
setExistingActions(bulk_action.parseActions(bulkActionNote!));
|
||||
}
|
||||
|
||||
useTriliumEvent("entitiesReloaded", () => {
|
||||
console.log("Got entities reloaded.");
|
||||
useEffect(() => refreshExistingActions(), []);
|
||||
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
|
||||
if (loadResults.getAttributeRows().find((row) =>
|
||||
row.type === "label" && row.name === "action" && row.noteId === "_bulkAction")) {
|
||||
refreshExistingActions();
|
||||
}
|
||||
});
|
||||
|
||||
return ( selectedOrActiveNoteIds &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user