fix(react): note context not always updated

This commit is contained in:
Elian Doran
2025-08-21 09:17:47 +03:00
parent 59486cd55d
commit 799e705ff8
2 changed files with 4 additions and 5 deletions

View File

@@ -231,19 +231,19 @@ export function useNoteContext() {
const [ noteContext, setNoteContext ] = useState<NoteContext>();
const [ notePath, setNotePath ] = useState<string | null | undefined>();
useTriliumEvent("activeContextChanged", ({ noteContext }) => {
console.log("Active context changed.");
useTriliumEventBeta("activeContextChanged", ({ noteContext }) => {
setNoteContext(noteContext);
setNotePath(noteContext.notePath);
});
useTriliumEventBeta("setNoteContext", ({ noteContext }) => {
console.log("Set note context", noteContext, noteContext.noteId);
setNoteContext(noteContext);
});
useTriliumEvent("noteSwitchedAndActivated", ({ noteContext }) => {
useTriliumEventBeta("noteSwitchedAndActivated", ({ noteContext }) => {
console.log("Note switched and activated")
setNoteContext(noteContext);
});
useTriliumEvent("noteSwitched", ({ noteContext, notePath }) => {
useTriliumEventBeta("noteSwitched", ({ noteContext, notePath }) => {
console.warn("Note switched", notePath);
setNotePath(notePath);
});