Fix cleanLayout stripping expression columns (e.g. Year) on restore
Expression columns (bucket, computed) are defined in cfg.expressions and are valid pivot axes, but weren't in validCols (raw table columns), so they were filtered out of group_by/split_by on every layout restore. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
742d4b4cc4
commit
8f009e468e
@ -18,7 +18,8 @@ function loadPerspective() {
|
|||||||
function cleanLayout(cfg, validCols) {
|
function cleanLayout(cfg, validCols) {
|
||||||
if (!cfg) return cfg
|
if (!cfg) return cfg
|
||||||
const c = { ...cfg }
|
const c = { ...cfg }
|
||||||
const ok = (col) => validCols.has(col)
|
const exprNames = new Set(Object.keys(cfg.expressions || {}))
|
||||||
|
const ok = (col) => validCols.has(col) || exprNames.has(col)
|
||||||
if (c.columns) c.columns = c.columns.filter(col => col == null || ok(col))
|
if (c.columns) c.columns = c.columns.filter(col => col == null || ok(col))
|
||||||
if (c.group_by) c.group_by = c.group_by.filter(ok)
|
if (c.group_by) c.group_by = c.group_by.filter(ok)
|
||||||
if (c.split_by) c.split_by = c.split_by.filter(ok)
|
if (c.split_by) c.split_by = c.split_by.filter(ok)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user