From 03a7fe1282d9c9b0020e44b59c5380678a30b3b0 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 28 Aug 2025 20:04:47 +0300 Subject: [PATCH] fix(react/floating_buttons): react to note type/mime changes --- apps/client/src/widgets/react/hooks.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx index d1719b147..af5378144 100644 --- a/apps/client/src/widgets/react/hooks.tsx +++ b/apps/client/src/widgets/react/hooks.tsx @@ -196,6 +196,7 @@ export function useNoteContext() { const [ noteContext, setNoteContext ] = useState(); const [ notePath, setNotePath ] = useState(); const [ note, setNote ] = useState(); + const [ refreshCounter, setRefreshCounter ] = useState(0); useEffect(() => { setNote(noteContext?.note); @@ -208,6 +209,11 @@ export function useNoteContext() { useTriliumEvent("frocaReloaded", () => { setNote(noteContext?.note); }); + useTriliumEvent("noteTypeMimeChanged", ({ noteId }) => { + if (noteId === note?.noteId) { + setRefreshCounter(refreshCounter + 1); + } + }); const parentComponent = useContext(ParentComponent) as ReactWrappedWidget; useDebugValue(() => `notePath=${notePath}, ntxId=${noteContext?.ntxId}`);