Skip to content

Commit 126811e

Browse files
committed
chore: update logic
1 parent ba19cac commit 126811e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Cell/useCellResize.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export default function useCelResize(
5252
const offset = event.pageX - startPageX.current;
5353
const oldWidth = colsWidthsRef.current.get(columnKey);
5454
let newWidth = startRealWidth.current + (isFixRight ? -offset : offset);
55-
const index = colsKeys.findIndex(key => key === columnKey);
5655

5756
const minWidth = typeof resizable === 'object' ? resizable.minWidth || 0 : 0;
5857
if (newWidth < minWidth) {
@@ -71,6 +70,7 @@ export default function useCelResize(
7170
let addWidthColumnKey: React.Key;
7271
const isDecreasingWidth = oldWidth - newWidth > 0;
7372
if (smallThanWidth > 0 && isDecreasingWidth) {
73+
const index = colsKeys.findIndex(key => key === columnKey);
7474
addWidthColumnKey = colsKeys[index + 1] ?? colsKeys[index - 1];
7575
}
7676

0 commit comments

Comments
 (0)