NextJS 13 static page reloads
Answered
Transvaal lion posted this in #help-forum
Transvaal lionOP
Hey !
I have an issue with only 2 pages from my app, they hard reload (as if I pressed F5) which shouldn't happen.
I have the latest version (13.4.19) and I tried some others (13.4.12 and 13.4.16) same thing.
Here's how one of the two pages looks like:
Any idea ? I'm really stuck and I can't find anything in the github issues
I have an issue with only 2 pages from my app, they hard reload (as if I pressed F5) which shouldn't happen.
I have the latest version (13.4.19) and I tried some others (13.4.12 and 13.4.16) same thing.
Here's how one of the two pages looks like:
import {getServerSession} from "next-auth";
import {DataTable} from "@/app/[locale]/(dashboard)/dashboard/lots/components/lots-table/data-table";
import {columns} from "@/app/[locale]/(dashboard)/dashboard/lots/components/lots-table/columns";
import {db} from "@/lib/db";
import {Lot} from "@prisma/client";
import {authOptions} from "@/app/api/auth/[...nextauth]/route";
import {AddLot} from "@/app/[locale]/(dashboard)/dashboard/lots/components/add-lot";
async function getLots() {
const session = await getServerSession(authOptions);
const lots = await db.lot.findMany({where: {user: {domainId: session?.user?.domainId}}});
return lots.reverse();
}
export default async function LotPage() {
const lots = await getLots();
return (<>
<div className="h-full space-y-8 p-8 flex-grow flex-col">
<div className="flex items-center justify-between space-y-2">
<div>
<h2 className="text-2xl font-bold tracking-tight">Your Lots</h2>
</div>
<AddLot/>
</div>
<DataTable data={lots} columns={columns}/>
</div>
</>)
}Any idea ? I'm really stuck and I can't find anything in the github issues
Answered by riský
27 Replies
what do you mean by hard reload? i.e where is this happening? are you clicking on a link?
@riský what do you mean by hard reload? i.e where is this happening? are you clicking on a link?
Transvaal lionOP
Hard reload, as in if I pressed reload on the browser, (just as F5 or Ctrl + R)
Yes I am, a next/link
Yes I am, a next/link
and this is tested in production mode im assuming
@riský and this is tested in production mode im assuming
Transvaal lionOP
dev and prod do the same thing yes
can you share any more about you code (its fine if you don't want to)
@riský can you share any more about you code (its fine if you don't want to)
Transvaal lionOP
What would you need ?
actually,
do you have a loading.tsx page
Transvaal lionOP
no
good
Answer
that was it
I forgot I put that for those 2 pages
weird though, it's been there for a while (because of a cache issue if I recall) and it didn't cause any issues before
i think they still download the page on hover and click
its just not when in viewport
Transvaal lionOP
alright I'll read the doc again, thank you!
and what about middlewires, do you have any of them? (i also doubt that they can mess with it that much)
Transvaal lionOP
yes, intl and next-auth
but it's fine, you solved my issue, it was the prefetch in the <Link /> component
ohh yay!
i thought you had a different issue, but thats good to hear!
Transvaal lionOP
well I do have a cache issue now because the data is prefetched, but it's nothing I can't solve!
Thank you have a nice day
Thank you have a nice day
(i edited my answer to make it more clear what the issue was, so that google would see it better 🙂 )