Describe the bug
In an Explore dashboard's pivot table, drilled-in (expanded) rows are discarded whenever the pivot configuration changes. Adding a measure or dimension, reordering the row dimensions, or changing the sort all collapse the tree back to the top level, so the user has to manually re-expand everything. On a wide dashboard this makes iterative analysis painful, because every small change wipes your place.
To Reproduce
- Open an Explore dashboard and switch to the Pivot view.
- Put 2 or 3 dimensions on Rows (for example
Application > Source > Month) and a few measures on Columns.
- Expand several rows to drill in.
- Do any of the following: add a measure to Columns, add or reorder a row dimension, or click a column header to sort.
- The entire tree collapses to the top level and all expanded rows are lost.
Expected behavior
Expansion should be preserved across config changes wherever the rows still exist. Adding a measure or column, or adding or removing a row dimension at the deepest level, should not collapse anything. Reordering or sorting should keep the same value nodes expanded.
Desktop
- OS: macOS
- Browser: Chrome
- Version: v0.88.5 and
main (verified on commit d43bb02)
Additional context
Root cause: the pivot tracks expanded rows by positional TanStack keys (dot paths like "0.1.2" that index into subRows) rather than by dimension values. Any config change re-partitions or re-orders the row tree, so those positional keys no longer point at the same rows and the expanded state is thrown away. The setPivotRows, setPivotColumns, and addPivotField reducers reset expanded = {} (web-common/src/features/dashboards/stores/dashboard-stores.ts), and pivot-expansion.ts traverses positionally via getValuesForExpandedKey and addExpandedDataToPivot (key.split(".").map((i) => parseInt(i, 10))).
Proposed fix: track expansion by dimension-value paths (a stable getRowId on the pivot table plus value-keyed expanded state), so expansion survives add, reorder, and sort. Related prior work: closed #6916 "Pivot: Expand and collapse" (design doc). We would like to contribute the implementation, and are opening this issue first to align on the approach before submitting the PR.
Describe the bug
In an Explore dashboard's pivot table, drilled-in (expanded) rows are discarded whenever the pivot configuration changes. Adding a measure or dimension, reordering the row dimensions, or changing the sort all collapse the tree back to the top level, so the user has to manually re-expand everything. On a wide dashboard this makes iterative analysis painful, because every small change wipes your place.
To Reproduce
Application > Source > Month) and a few measures on Columns.Expected behavior
Expansion should be preserved across config changes wherever the rows still exist. Adding a measure or column, or adding or removing a row dimension at the deepest level, should not collapse anything. Reordering or sorting should keep the same value nodes expanded.
Desktop
main(verified on commit d43bb02)Additional context
Root cause: the pivot tracks expanded rows by positional TanStack keys (dot paths like
"0.1.2"that index intosubRows) rather than by dimension values. Any config change re-partitions or re-orders the row tree, so those positional keys no longer point at the same rows and the expanded state is thrown away. ThesetPivotRows,setPivotColumns, andaddPivotFieldreducers resetexpanded = {}(web-common/src/features/dashboards/stores/dashboard-stores.ts), andpivot-expansion.tstraverses positionally viagetValuesForExpandedKeyandaddExpandedDataToPivot(key.split(".").map((i) => parseInt(i, 10))).Proposed fix: track expansion by dimension-value paths (a stable
getRowIdon the pivot table plus value-keyed expanded state), so expansion survives add, reorder, and sort. Related prior work: closed #6916 "Pivot: Expand and collapse" (design doc). We would like to contribute the implementation, and are opening this issue first to align on the approach before submitting the PR.