fix: only check fetcher if we are greater than page 0

This commit is contained in:
Derrick Hammer 2023-12-18 01:47:38 -05:00
parent b88c14407f
commit 41e3a34ab7
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 5 deletions

View File

@ -50,12 +50,14 @@ const Feed = ({
setCurrentPage((prevPage) => prevPage + 1); setCurrentPage((prevPage) => prevPage + 1);
}; };
if (fetcher.state === "loading") { if (currentPage) {
return <div>Loading...</div>; if (fetcher.state === "loading") {
} return <div>Loading...</div>;
}
if (!fetcher.data) { if (!fetcher.data) {
return <div>Failed to load</div>; return <div>Failed to load</div>;
}
} }
return ( return (