From df8b6f56c9b8fdc10ccbbbffc89d2eb0251c39cb Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 17 Sep 2026 15:10:40 -0400 Subject: [PATCH] Re-apply the ordering columns after loading a saved layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switching to a saved layout dropped pf_bucket_ord and pf_segment_ord. restore() replaces `expressions` wholesale rather than merging, and a layout saved before the feature existed carries none to restore — the same fault initViewer had, fixed there and not generalised. The layout is persisted from the merged config afterwards, so the saved copy picks the expressions up rather than re-dropping them on the next load. Co-Authored-By: Claude Opus 5 (1M context) --- ui/src/views/Forecast.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/src/views/Forecast.jsx b/ui/src/views/Forecast.jsx index ce580d2..2d37821 100644 --- a/ui/src/views/Forecast.jsx +++ b/ui/src/views/Forecast.jsx @@ -1326,8 +1326,17 @@ export default function Forecast({ sources = [], sourceId, versions = [], versio cfg.split_by_depth != null ? cfg.split_by_depth - 1 : null) if (cfg.group_by_depth != null) setExpandDepth(cfg.group_by_depth - 1) else if (cfg.expand_depth != null) await applyDepth(cfg.expand_depth) + + // restore() replaces `expressions` wholesale, so loading a layout drops the + // ordering columns — and a layout saved before they existed has none to put + // back. Re-applied after every restore that comes from a saved config, which + // is the general form of the fix initViewer already needed. + await syncOrderExpressions() + setActiveLayoutId(layout.id) - await persistLayout(versionId, cfg) + // After the sync, so the persisted copy carries the expressions too. + const merged = await captureConfig() + await persistLayout(versionId, merged || cfg) } function deleteLayout(id, e) {