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
chore(react/ribbon): simplify useNoteContext & handle setNoteContext
Elian Doran82bdb76d75b0
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsxindex 1110f4e1b8..0b0cea3a0d 100644--- a/apps/client/src/widgets/react/hooks.tsx+++ b/apps/client/src/widgets/react/hooks.tsx@@ -202,17 +202,10 @@ export function useNoteContext() {setNote(noteContext?.note);}, [ notePath ]);- useTriliumEvent("activeContextChanged", ({ noteContext }) => {+ useTriliumEvents([ "setNoteContext", "activeContextChanged", "noteSwitchedAndActivated", "noteSwitched" ], ({ noteContext }) => {setNoteContext(noteContext);setNotePath(noteContext.notePath);});- useTriliumEvent("noteSwitchedAndActivated", ({ noteContext }) => {- setNoteContext(noteContext);- });- useTriliumEvent("noteSwitched", ({ notePath, noteContext }) => {- setNoteContext(noteContext);- setNotePath(notePath);- });useTriliumEvent("frocaReloaded", () => {setNote(noteContext?.note);});