address review: include target column key in sort cache

This commit is contained in:
Evan Rusackas
2026-04-23 02:31:45 -07:00
parent 27feb46107
commit b947381f5f

View File

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