chore(core): fix references to getHoistedNoteId

This commit is contained in:
Elian Doran 2026-01-06 12:29:13 +02:00
parent b9a59fe0c4
commit 321fcf34f2
No known key found for this signature in database
4 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import type { EntityChange } from "@triliumnext/commons";
import { getContext } from "@triliumnext/core/src/services/context";
import { getContext, getHoistedNoteId as getHoistedNoteIdInternal } from "@triliumnext/core/src/services/context";
type Callback = (...args: any[]) => any;
@ -18,7 +18,7 @@ function wrap(callback: Callback) {
}
function getHoistedNoteId() {
return getContext().get("hoistedNoteId") || "root";
return getHoistedNoteIdInternal();
}
function getComponentId() {

View File

@ -2,7 +2,7 @@
import becca from "./becca.js";
import { getLog } from "../services/log.js";
import { getContext } from "src/services/context.js";
import { getHoistedNoteId } from "src/services/context.js";
function isNotePathArchived(notePath: string[]) {
const noteId = notePath[notePath.length - 1];
@ -82,7 +82,7 @@ function getNoteTitleArrayForPath(notePathArray: string[]) {
let hoistedNotePassed = false;
// this is a notePath from outside of hoisted subtree, so the full title path needs to be returned
const hoistedNoteId = getContext().getHoistedNoteId();
const hoistedNoteId = getHoistedNoteId();
const outsideOfHoistedSubtree = !notePathArray.includes(hoistedNoteId);
for (const noteId of notePathArray) {

View File

@ -9,7 +9,7 @@ import TaskContext from "../../services/task_context.js";
import utils from "../../services/utils.js";
import AbstractBeccaEntity from "./abstract_becca_entity.js";
import BNote from "./bnote.js";
import { getContext } from "src/services/context";
import { getHoistedNoteId } from "src/services/context";
/**
* Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
@ -160,7 +160,7 @@ class BBranch extends AbstractBeccaEntity<BBranch> {
}
}
if ((this.noteId === "root" || this.noteId === getContext().getHoistedNoteId()) && !this.isWeak) {
if ((this.noteId === "root" || this.noteId === getHoistedNoteId()) && !this.isWeak) {
throw new Error("Can't delete root or hoisted branch/note");
}

View File

@ -16,3 +16,7 @@ export function getContext(): ExecutionContext {
if (!ctx) throw new Error("Context not initialized");
return ctx;
}
export function getHoistedNoteId() {
return getContext().get("hoistedNoteId") || "root";
}