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,6 +50,7 @@ const Feed = ({
setCurrentPage((prevPage) => prevPage + 1); setCurrentPage((prevPage) => prevPage + 1);
}; };
if (currentPage) {
if (fetcher.state === "loading") { if (fetcher.state === "loading") {
return <div>Loading...</div>; return <div>Loading...</div>;
} }
@ -57,6 +58,7 @@ const Feed = ({
if (!fetcher.data) { if (!fetcher.data) {
return <div>Failed to load</div>; return <div>Failed to load</div>;
} }
}
return ( return (
<section className={`w-full h-full space-y-6 ${className}`}> <section className={`w-full h-full space-y-6 ${className}`}>