Skip to content

Commit 72c2ce9

Browse files
committed
only scroll to selected image on initial filmstrip mount
1 parent df9f745 commit 72c2ce9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/components/panel/Filmstrip.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ const FilmstripList = ({
313313
const isAnimatingScroll = useRef(false);
314314
const scrollAnimationTimeout = useRef<any>(null);
315315
const pendingScrollTarget = useRef<number | null>(null);
316+
const hasCompletedInitialScroll = useRef(false);
316317
const itemHeight = Math.max(20, height - VERTICAL_PADDING);
317318

318319
const getColumnWidth = useCallback(
@@ -472,6 +473,11 @@ const FilmstripList = ({
472473
performSafeScroll(index);
473474
}
474475
prevSelectedPath.current = currentPath;
476+
} else {
477+
if (!hasCompletedInitialScroll.current && !isItemVisible(index)) {
478+
performSafeScroll(index, true);
479+
}
480+
hasCompletedInitialScroll.current = true;
475481
}
476482
}
477483
}

0 commit comments

Comments
 (0)