Skip to content

Build your personal knowledge base with Trilium Notes

fix(views/board): reordering same column not working

Elian Dorane2157aab26fd
diff --git a/apps/client/src/widgets/view_widgets/board_view/differential_renderer.ts b/apps/client/src/widgets/view_widgets/board_view/differential_renderer.ts
index 9d08b90b31..a5ab3c9a80 100644
--- a/apps/client/src/widgets/view_widgets/board_view/differential_renderer.ts
+++ b/apps/client/src/widgets/view_widgets/board_view/differential_renderer.ts
@@ -137,7 +137,6 @@ export class DifferentialBoardRenderer {
const orderChanged = !this.arraysEqual(oldState.columnOrder, newState.columnOrder);
if (orderChanged) {
- console.log("Column order changed from", oldState.columnOrder, "to", newState.columnOrder);
// If order changed, we need to reorder the columns in the DOM
this.reorderColumns(newState.columnOrder);
}
@@ -175,8 +174,6 @@ export class DifferentialBoardRenderer {
}
private reorderColumns(newOrder: string[]): void {
- console.log("Reordering columns to:", newOrder);
-
// Get all existing column elements
const $columns = this.$container.find('.board-column');
const $addColumnButton = this.$container.find('.board-add-column');
@@ -213,8 +210,6 @@ export class DifferentialBoardRenderer {
if ($addColumnButton.length) {
this.$container.append($addColumnButton);
}
-
- console.log("Column reordering complete");
}
private updateColumnCards(column: string, oldCards: { note: any; branch: any }[], newCards: { note: any; branch: any }[]): void {
diff --git a/apps/client/src/widgets/view_widgets/board_view/drag_handler.ts b/apps/client/src/widgets/view_widgets/board_view/drag_handler.ts
index 6116a147ca..e8bd183e75 100644
--- a/apps/client/src/widgets/view_widgets/board_view/drag_handler.ts
+++ b/apps/client/src/widgets/view_widgets/board_view/drag_handler.ts
@@ -490,13 +490,8 @@ export class BoardDragHandler {
const $dropIndicator = this.$container.find(".column-drop-indicator.show");
if ($dropIndicator.length > 0) {
- // Get current column order from the DOM
- const currentOrder = Array.from(this.$container.find('.board-column')).map(el =>
- $(el).attr('data-column')
- ).filter(col => col) as string[];
-
- console.log("Current order:", currentOrder);
- console.log("Dragged column:", this.context.draggedColumn);
+ // Get current column order from the API (source of truth)
+ const currentOrder = [...this.api.columns];
let newOrder = [...currentOrder];
@@ -513,16 +508,13 @@ export class BoardDragHandler {
// Insert before the next column
const nextColumnValue = $nextColumn.attr('data-column');
insertIndex = newOrder.indexOf(nextColumnValue!);
- console.log("Inserting before column:", nextColumnValue, "at index:", insertIndex);
} else if ($prevColumn.length > 0) {
// Insert after the previous column
const prevColumnValue = $prevColumn.attr('data-column');
insertIndex = newOrder.indexOf(prevColumnValue!) + 1;
- console.log("Inserting after column:", prevColumnValue, "at index:", insertIndex);
} else {
// Insert at the beginning
insertIndex = 0;
- console.log("Inserting at the beginning");
}
// Insert the dragged column at the determined position
@@ -531,16 +523,11 @@ export class BoardDragHandler {
} else {
// Fallback: insert at the end
newOrder.push(this.context.draggedColumn);
- console.log("Fallback: inserting at the end");
}
- console.log("New order:", newOrder);
-
// Update column order in API
await this.api.reorderColumns(newOrder);
- console.log(`Moved column "${this.context.draggedColumn}" to new position`);
-
// Refresh the board to reflect the changes
await this.onBoardRefresh();
} else {