Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(client/load_results): component ID not preserved for attributes & branches
Elian Doran8ad779be66f8
diff --git a/apps/client/src/services/load_results.ts b/apps/client/src/services/load_results.tsindex 899560de42..5b6589c652 100644--- a/apps/client/src/services/load_results.ts+++ b/apps/client/src/services/load_results.ts@@ -1,4 +1,5 @@import type { AttachmentRow, EtapiTokenRow, NoteType, OptionNames } from "@triliumnext/commons";+import type { AttributeType } from "../entities/fattribute.js";import type { EntityChange } from "../server_types.js";@@ -131,11 +132,19 @@ export default class LoadResults {}addBranch(branchId: string, componentId: string) {+ console.log("Got branch with ", branchId, componentId);this.branchRows.push({ branchId, componentId });}getBranchRows() {- return this.branchRows.map((row) => this.getEntityRow("branches", row.branchId)).filter((branch) => !!branch);+ return this.branchRows.map((row) => {+ const branch = this.getEntityRow("branches", row.branchId);+ if (branch) {+ // Merge the componentId from the tracked row with the entity data+ return { ...branch, componentId: row.componentId };+ }+ return null;+ }).filter((branch) => !!branch) as BranchRow[];}addNoteReordering(parentNoteId: string, componentId: string) {@@ -153,7 +162,14 @@ export default class LoadResults {getAttributeRows(componentId = "none"): AttributeRow[] {return this.attributeRows.filter((row) => row.componentId !== componentId)- .map((row) => this.getEntityRow("attributes", row.attributeId))+ .map((row) => {+ const attr = this.getEntityRow("attributes", row.attributeId);+ if (attr) {+ // Merge the componentId from the tracked row with the entity data+ return { ...attr, componentId: row.componentId };+ }+ return null;+ }).filter((attr) => !!attr) as AttributeRow[];}