mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 15:25:51 +01:00
fix(react/type_widgets): unable to switch view-mode for same note
This commit is contained in:
@@ -136,7 +136,7 @@ function useNoteInfo() {
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(refresh, [ actualNote, noteContext]);
|
||||
useEffect(refresh, [ actualNote, noteContext, noteContext?.viewScope?.viewMode ]);
|
||||
useTriliumEvent("readOnlyTemporarilyDisabled", ({ noteContext: eventNoteContext }) => {
|
||||
if (eventNoteContext?.ntxId !== noteContext?.ntxId) return;
|
||||
refresh();
|
||||
|
||||
@@ -239,6 +239,7 @@ export function useNoteContext() {
|
||||
const [ noteContext, setNoteContext ] = useState<NoteContext>();
|
||||
const [ notePath, setNotePath ] = useState<string | null | undefined>();
|
||||
const [ note, setNote ] = useState<FNote | null | undefined>();
|
||||
const [ , setViewMode ] = useState<string>();
|
||||
const [ refreshCounter, setRefreshCounter ] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -248,6 +249,7 @@ export function useNoteContext() {
|
||||
useTriliumEvents([ "setNoteContext", "activeContextChanged", "noteSwitchedAndActivated", "noteSwitched" ], ({ noteContext }) => {
|
||||
setNoteContext(noteContext);
|
||||
setNotePath(noteContext.notePath);
|
||||
setViewMode(noteContext.viewScope?.viewMode);
|
||||
});
|
||||
useTriliumEvent("frocaReloaded", () => {
|
||||
setNote(noteContext?.note);
|
||||
|
||||
Reference in New Issue
Block a user