Skip to content

Build your personal knowledge base with Trilium Notes

fix(dashboard): handle gridstack v13 returning no grid from init

Elian Doran386435f58169
diff --git a/apps/client/src/widgets/collections/dashboard/index.tsx b/apps/client/src/widgets/collections/dashboard/index.tsx
index d043c1487e..8c77fa1eb4 100644
--- a/apps/client/src/widgets/collections/dashboard/index.tsx
+++ b/apps/client/src/widgets/collections/dashboard/index.tsx
@@ -207,6 +207,10 @@ function useDashboardGrid({ note, notes, viewConfig, saveConfig, containerRef, g
breakpoints: [{ w: SINGLE_COLUMN_BREAKPOINT, c: 1 }]
}
}, container);
+ // Gridstack only declines to initialize without a DOM (server-side rendering) or without the
+ // element it was pointed at — neither happens once the container ref is attached.
+ if (!grid) return;
+
gridRef.current = grid;
grid.on("change", () => persistLayout(grid));