fix(dashboard): widgets hold their place as content loads and the window resizes (#5713)
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 1m18s
CI / unit (push) Successful in 1m34s
CI / publish (push) Successful in 1m8s

Wider than 12 columns, pack() took the first free spot for each widget's
content-fitted height, and that height changes as each widget's content
arrives and on every poll, so widgets traded columns and order as the page
loaded (CI 9107: test_dash_layout fails at 16, 18 and 24 columns on the old
pack()). Now columns and order are decided at the saved heights, from the
saved layout and the column count alone; each widget then drops at its
fitted height onto what is above it in its columns, so content only closes
gaps.

The dashboard moves widgets into place in two passes, below everything first
and then up, so Gridstack never pushes a not-yet-moved widget out of its
place on the way. The share view passes saved heights the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 11:32:23 -04:00
co-authored by Claude Opus 5.5
parent 630dcc867e
commit 2119d20f18
3 changed files with 47 additions and 15 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ document.addEventListener('DOMContentLoaded', function () {
function relayout() {
var cols = L.columnsFor(grid.clientWidth);
var pos = L.pack(cells().map(function (el) {
var s = L.viewed(el); s.id = el.dataset.id; s.h = el._fitH || s.h; return s;
var s = L.viewed(el); s.id = el.dataset.id; s.full = s.h; s.h = el._fitH || s.h; return s;
}), cols);
grid.style.gridTemplateColumns = 'repeat(' + cols + ', 1fr)';
cells().forEach(function (el) {