Skip to content

Commit 82217b2

Browse files
authored
fix(client-core): incorrect index in movePivotItem (#6684) Thanks to @telunc!
1 parent b97268f commit 82217b2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/cubejs-client-core/src/utils.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,17 @@ export function movePivotItem(
288288
if (id === 'measures') {
289289
destinationIndex = lastIndex + 1;
290290
} else if (
291+
sourceAxis === destinationAxis &&
291292
destinationIndex >= lastIndex &&
292293
nextPivotConfig[destinationAxis][lastIndex] === 'measures'
293294
) {
294295
destinationIndex = lastIndex - 1;
296+
} else if (
297+
sourceAxis !== destinationAxis &&
298+
destinationIndex > lastIndex &&
299+
nextPivotConfig[destinationAxis][lastIndex] === 'measures'
300+
) {
301+
destinationIndex = lastIndex;
295302
}
296303

297304
nextPivotConfig[sourceAxis].splice(sourceIndex, 1);

0 commit comments

Comments
 (0)