Skip to content

Commit cd3a78b

Browse files
committed
Prevent duplicate or premature pagination requests by adding additional fetch state checks
1 parent d8d76ca commit cd3a78b

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

‎packages/vscode/src/views/panel/frontend/hooks/latest-donations.ts‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ export const use_latest_donations = () => {
7777
}, [viewing_donations, fetch_donations])
7878

7979
const on_fetch_next_page = useCallback(async () => {
80-
if (is_fetching_next || !has_more) {
80+
if (
81+
is_fetching_next ||
82+
!has_more ||
83+
is_fetching ||
84+
is_revalidating ||
85+
!fetched_once
86+
) {
8187
return
8288
}
8389
set_is_fetching_next(true)
@@ -110,7 +116,14 @@ export const use_latest_donations = () => {
110116
} finally {
111117
set_is_fetching_next(false)
112118
}
113-
}, [is_fetching_next, has_more, page])
119+
}, [
120+
is_fetching_next,
121+
has_more,
122+
page,
123+
is_fetching,
124+
is_revalidating,
125+
fetched_once
126+
])
114127

115128
return {
116129
viewing_donations,

0 commit comments

Comments
 (0)