mirror of
https://github.com/zadam/trilium.git
synced 2025-12-03 22:14:24 +01:00
fix(note_list): note list shown when switching types (e.g. for mindmap)
This commit is contained in:
parent
276241cdff
commit
49243148a2
@ -1,5 +1,5 @@
|
||||
import { allViewTypes, ViewModeMedia, ViewModeProps, ViewTypeOptions } from "./interface";
|
||||
import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useTriliumEvent } from "../react/hooks";
|
||||
import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumEvent } from "../react/hooks";
|
||||
import FNote from "../../entities/fnote";
|
||||
import "./NoteList.css";
|
||||
import { useEffect, useRef, useState } from "preact/hooks";
|
||||
@ -53,10 +53,11 @@ const ViewComponents: Record<ViewTypeOptions, { normal: LazyLoadedComponent, pri
|
||||
export default function NoteList(props: Pick<NoteListProps, "displayOnlyCollections" | "media" | "onReady" | "onProgressChanged">) {
|
||||
const { note, noteContext, notePath, ntxId, viewScope } = useNoteContext();
|
||||
const viewType = useNoteViewType(note);
|
||||
const noteType = useNoteProperty(note, "type");
|
||||
const [ enabled, setEnabled ] = useState(noteContext?.hasNoteList());
|
||||
useEffect(() => {
|
||||
setEnabled(noteContext?.hasNoteList());
|
||||
}, [ note, noteContext, viewType, viewScope?.viewMode ])
|
||||
}, [ note, noteContext, viewType, viewScope?.viewMode, noteType ])
|
||||
return <CustomNoteList viewType={viewType} note={note} isEnabled={!!enabled} notePath={notePath} ntxId={ntxId} {...props} />
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user