From b947381f5ff907065335bb40303e22402659cfc4 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 23 Apr 2026 02:31:45 -0700 Subject: [PATCH] address review: include target column key in sort cache --- .../src/react-pivottable/TableRenderers.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx index 67a51431482..d841af8256c 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx +++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx @@ -839,7 +839,10 @@ export function TableRenderer({ }; newSortingOrder[columnIndex] = newDirection; - const cacheKey = `${columnIndex}-${visColKeys.length}-${rowEnabled}-${rowPartialOnTop}-${newDirection}`; + // Include the target column's flat key so different visible-column sets + // with the same length don't collide in the cache. + const sortTargetKey = flatKey(visColKeys[columnIndex] ?? []); + const cacheKey = `${columnIndex}-${visColKeys.length}-${sortTargetKey}-${rowEnabled}-${rowPartialOnTop}-${newDirection}`; let newRowKeys; if (sortCacheRef.current.has(cacheKey)) { const cachedRowKeys = sortCacheRef.current.get(cacheKey);