Skip to content

Commit 18c43e3

Browse files
committed
refactor: update infinite scroll configuration and improve feed component structure
1 parent 2e1fb00 commit 18c43e3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/features/feed/components/Feed.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ export const Feed = () => {
2121
tags: userSelectedTags.map((tag) => tag.label.toLocaleLowerCase()),
2222
})
2323

24-
const [infiniteRef] = useInfiniteScroll({
24+
const [infiniteRef, {rootRef}] = useInfiniteScroll({
2525
loading: isLoading,
2626
hasNextPage: Boolean(hasNextPage),
2727
onLoadMore: fetchNextPage,
2828
disabled: Boolean(error),
29-
rootMargin: '0px 0px 400px 0px',
29+
rootMargin: '0px 0px 100% 0px',
3030
})
3131

3232
if (isInitialLoading) {
@@ -46,7 +46,8 @@ export const Feed = () => {
4646
}
4747

4848
return (
49-
<div className="feed">
49+
<div ref={rootRef} className="feed scrollable" style={{ overflow: 'auto', maxHeight: '100vh' }}>
50+
5051
<div key={`adv`} className="feedItem">
5152
<AdvFeedItem />
5253
</div>

0 commit comments

Comments
 (0)