This is a reproducible example code which uses URQL with Next.js (v13, App Router) framework.
- Run app
$ npm install
$ npm run dev
-
Open a web browser and visit
http://localhost:3000
then open Developer Tools. -
Click the link that will lead you to '/query' page.
-
Check the console messages. (Sometimes it works fine but Reload will trigger the Problem.)
import { createUrqlClientAndSsr } from "@/graphql";
export default function GqlProvider({ children }: React.PropsWithChildren) {
const [client, ssr] = React.useMemo(() => {
console.log("GqlProvider useMemo called");
return createUrqlClientAndSsr();
}, []);
return (
<UrqlProvider client={client} ssr={ssr}>
{children}
</UrqlProvider>
);
}
- I don't know why GqlProvder is initializing infinitely.