mirror of
https://github.com/zadam/trilium.git
synced 2026-02-19 20:24:28 +01:00
fix(note_list): subtree leaking into classic collections
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Deploy Documentation / Build and Deploy Documentation (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Deploy Documentation / Build and Deploy Documentation (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
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