mirror of
https://github.com/TriliumNext/Trilium.git
synced 2025-12-10 18:45:52 -06:00
fix(note_list): subtree leaking into classic collections
This commit is contained in:
parent
2695b7fc38
commit
408073ee19
@ -147,6 +147,7 @@ export function useNoteViewType(note?: FNote | null): ViewTypeOptions | undefine
|
|||||||
export function useNoteIds(note: FNote | null | undefined, viewType: ViewTypeOptions | undefined, ntxId: string | null | undefined) {
|
export function useNoteIds(note: FNote | null | undefined, viewType: ViewTypeOptions | undefined, ntxId: string | null | undefined) {
|
||||||
const [ noteIds, setNoteIds ] = useState<string[]>([]);
|
const [ noteIds, setNoteIds ] = useState<string[]>([]);
|
||||||
const [ includeArchived ] = useNoteLabelBoolean(note, "includeArchived");
|
const [ includeArchived ] = useNoteLabelBoolean(note, "includeArchived");
|
||||||
|
const directChildrenOnly = (viewType === "list" || viewType === "grid" || viewType === "table" || note?.type === "search");
|
||||||
|
|
||||||
async function refreshNoteIds() {
|
async function refreshNoteIds() {
|
||||||
if (!note) {
|
if (!note) {
|
||||||
@ -157,7 +158,7 @@ export function useNoteIds(note: FNote | null | undefined, viewType: ViewTypeOpt
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getNoteIds(note: FNote) {
|
async function getNoteIds(note: FNote) {
|
||||||
if (viewType === "list" || viewType === "grid" || viewType === "table" || note.type === "search") {
|
if (directChildrenOnly) {
|
||||||
return await note.getChildNoteIdsWithArchiveFiltering(includeArchived);
|
return await note.getChildNoteIdsWithArchiveFiltering(includeArchived);
|
||||||
} else {
|
} else {
|
||||||
return await note.getSubtreeNoteIds(includeArchived);
|
return await note.getSubtreeNoteIds(includeArchived);
|
||||||
@ -165,7 +166,9 @@ export function useNoteIds(note: FNote | null | undefined, viewType: ViewTypeOpt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Refresh on note switch.
|
// Refresh on note switch.
|
||||||
useEffect(() => { refreshNoteIds() }, [ note, includeArchived ]);
|
useEffect(() => {
|
||||||
|
refreshNoteIds()
|
||||||
|
}, [ note, includeArchived, directChildrenOnly ]);
|
||||||
|
|
||||||
// Refresh on alterations to the note subtree.
|
// Refresh on alterations to the note subtree.
|
||||||
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
|
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user