Skip to content

Commit 7947cfe

Browse files
committed
fix closure issue
1 parent 5f54d21 commit 7947cfe

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • packages/hooks/src/useInfiniteScroll

packages/hooks/src/useInfiniteScroll/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ const useInfiniteScroll = <TData extends Data>(
7676
const scrollHeight = getScrollHeight(el);
7777
(el as Element).scrollTo(0, scrollHeight - scrollBottom.current);
7878
}
79-
} else {
80-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
81-
scrollMethod();
8279
}
8380
});
8481
});
@@ -145,6 +142,9 @@ const useInfiniteScroll = <TData extends Data>(
145142
loadMore();
146143
}
147144
};
145+
useUpdateEffect(() => {
146+
scrollMethod();
147+
}, [finalData]);
148148

149149
useEventListener(
150150
'scroll',

0 commit comments

Comments
 (0)