We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 177c0f6 commit 5f84d1eCopy full SHA for 5f84d1e
1 file changed
clients/web/src/components/virtual-list.tsx
@@ -53,14 +53,16 @@ export function VirtualList<VirtualItem>(props: {
53
virtualizer.scrollElement?.addEventListener("wheel", checkScrollDirection);
54
});
55
56
- createEffect(() => {
57
- if (
58
- autoScrollStarted ||
59
- !props.shouldAutoScroll ||
60
- !props.dataStream.length
61
- )
62
- return;
+ const initAutoScroll = (
+ shouldAutoScroll: boolean | undefined,
+ length: number,
+ ) => {
+ if (!shouldAutoScroll || !length || autoScrollStarted) return;
63
requestAnimationFrame(autoScroll);
+ };
+
64
+ createEffect(() => {
65
+ initAutoScroll(props.shouldAutoScroll, props.dataStream.length);
66
67
68
return (
0 commit comments