Skip to content

Commit 3f191e7

Browse files
committed
fix: load more not trigger loading
Signed-off-by: Innei <tukon479@gmail.com>
1 parent d47488f commit 3f191e7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/pages/recently/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ const RecentlyPage: NextPage = () => {
9999
() => [...Object.values(slicedData)].flat(1),
100100
[slicedData],
101101
)
102+
const loading = isLoading && data.length == 0
102103

103104
useEffect(() => {
104105
if (!fetchedData) {
@@ -127,14 +128,14 @@ const RecentlyPage: NextPage = () => {
127128
return
128129
}
129130

130-
if (isLoading) {
131+
if (loading) {
131132
return
132133
}
133134

134135
if (inView && hasNext) {
135136
setFetchBefore(data[data.length - 1].id)
136137
}
137-
}, [data, hasNext, inView, isLoading])
138+
}, [data, hasNext, inView, loading])
138139

139140
const handleDelete = async (id: string) => {
140141
await apiClient.shorthand.proxy(id).delete()
@@ -168,7 +169,7 @@ const RecentlyPage: NextPage = () => {
168169
{isLogged && <RecentlySendBox />}
169170
<div className="pb-4" />
170171

171-
{isLoading ? (
172+
{loading ? (
172173
<Loading />
173174
) : (
174175
<Fragment>

0 commit comments

Comments
 (0)