Re-apply the ordering columns after loading a saved layout

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) <noreply@anthropic.com>
This commit is contained in:
Paul Trowbridge 2026-09-17 15:10:40 -04:00
parent ec5d9e1dc3
commit df8b6f56c9

View File

@ -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) {