#fetchquery static rendering
1 messages · Page 1 of 1 (latest)
The knowledge sources do not explicitly mention a way to use fetchQuery while maintaining static rendering in Next.js.
In fact, the documentation states that related functions like preloadQuery specifically use a cache: 'no-store' policy, which prevents Server Components from being eligible for static rendering [Next.js Server Rendering].
While fetchQuery is the standard way to load Convex data in Server Components, Server Actions, and Route Handlers, it is typically used for dynamic data fetching [Next.js Server Rendering; Module: nextjs].
If you are using a pure server-side architecture without client components, the standard pattern provided is:
import { fetchQuery } from "convex/nextjs";
import { api } from "@/convex/_generated/api";
export default async function PureServerPage() {
// This call currently triggers dynamic rendering
const tasks = await fetchQuery(api.tasks.list, { list: "default" });
return (
<div>
{tasks.map(task => <p key={task._id}>{task.text}</p>)}
</div>
);
}
[Server Actions and Route Handlers]