mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
fix(react): note context not always updated
This commit is contained in:
parent
59486cd55d
commit
799e705ff8
@ -293,7 +293,6 @@ export class ReactWrappedWidget extends BasicWidget {
|
||||
|
||||
handleEvent<T extends EventNames>(name: T, data: EventData<T>): Promise<unknown[] | unknown> | null | undefined {
|
||||
const listener = this.listeners[name];
|
||||
console.log("Handle ", name, listener);
|
||||
listener?.(data);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user