shkim / urql-next13-error

Reproducible error example code for Next13 and URQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a reproducible example code which uses URQL with Next.js (v13, App Router) framework.

Reproduction Steps:

  1. Run app
$ npm install
$ npm run dev
  1. Open a web browser and visit http://localhost:3000 then open Developer Tools.

  2. Click the link that will lead you to '/query' page.

  3. 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.

About

Reproducible error example code for Next13 and URQL


Languages

Language:TypeScript 98.7%Language:CSS 1.0%Language:JavaScript 0.3%