From 82bdb76d75b0ffbac93698582fc3232b429eccd8 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 27 Aug 2025 13:06:57 +0300 Subject: [PATCH] chore(react/ribbon): simplify useNoteContext & handle setNoteContext --- apps/client/src/widgets/react/hooks.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx index 1110f4e1b..0b0cea3a0 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); });