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(views/board): some runtime errors
Elian Doranefd409da1721
diff --git a/apps/client/src/widgets/view_widgets/board_view/index.ts b/apps/client/src/widgets/view_widgets/board_view/index.tsindex 3c89c53095..998e1ad7ad 100644--- a/apps/client/src/widgets/view_widgets/board_view/index.ts+++ b/apps/client/src/widgets/view_widgets/board_view/index.ts@@ -236,8 +236,11 @@ export default class BoardView extends ViewMode<StateInfo> {e.preventDefault();$columnEl.removeClass("drag-over");- if (this.draggedNote && this.draggedNoteElement && this.draggedBranch) {- const currentColumn = this.draggedNoteElement.attr("data-current-column");+ const draggedNoteElement = this.draggedNoteElement;+ const draggedNote = this.draggedNote;+ const draggedBranch = this.draggedBranch;+ if (draggedNote && draggedNoteElement && draggedBranch) {+ const currentColumn = draggedNoteElement.attr("data-current-column");// Capture drop indicator position BEFORE removing itconst dropIndicator = $columnEl.find(".board-drop-indicator.show");@@ -264,32 +267,32 @@ export default class BoardView extends ViewMode<StateInfo> {try {// Handle column changeif (currentColumn !== column) {- await attributeService.setLabel(this.draggedNote.noteId, "status", column);+ await attributeService.setLabel(draggedNote.noteId, "status", column);}// Handle position change (works for both same column and different column moves)if (targetBranchId && moveType) {if (moveType === "before") {- console.log("Move before branch:", this.draggedBranch.branchId, "to", targetBranchId);- await branchService.moveBeforeBranch([this.draggedBranch.branchId], targetBranchId);+ console.log("Move before branch:", draggedBranch.branchId, "to", targetBranchId);+ await branchService.moveBeforeBranch([draggedBranch.branchId], targetBranchId);} else if (moveType === "after") {- console.log("Move after branch:", this.draggedBranch.branchId, "to", targetBranchId);- await branchService.moveAfterBranch([this.draggedBranch.branchId], targetBranchId);+ console.log("Move after branch:", draggedBranch.branchId, "to", targetBranchId);+ await branchService.moveAfterBranch([draggedBranch.branchId], targetBranchId);}}// Update the UIif (dropIndicator.length > 0) {- dropIndicator.after(this.draggedNoteElement);+ dropIndicator.after(draggedNoteElement);} else {- $columnEl.append(this.draggedNoteElement);+ $columnEl.append(draggedNoteElement);}// Update the data attributes- this.draggedNoteElement.attr("data-current-column", column);+ draggedNoteElement.attr("data-current-column", column);// Show success feedback- console.log(`Moved note "${this.draggedNote.title}" from "${currentColumn}" to "${column}"`);+ console.log(`Moved note "${draggedNote.title}" from "${currentColumn}" to "${column}"`);} catch (error) {console.error("Failed to update note position:", error);// Optionally show user-facing error message