Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(react/dialog): react to adding new bulk actions
Elian Doran3dd6b05d2ee9
diff --git a/apps/client/src/widgets/dialogs/bulk_actions.tsx b/apps/client/src/widgets/dialogs/bulk_actions.tsxindex 2df26926ce..9fabfd1942 100644--- a/apps/client/src/widgets/dialogs/bulk_actions.tsx+++ b/apps/client/src/widgets/dialogs/bulk_actions.tsx@@ -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 &&