-
-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite initialization? (with Graphql-codegen and Next.js 13) #3408
Comments
That's because this line should be importing from Changing your codegen file to be the one underneath should fix the issue at hand. schema: https://swapi-graphql.netlify.app/.netlify/functions/index
generates:
./src/graphql/generated.ts:
documents: ./src/graphql/documents.graphql
config:
urqlImportFrom: "@urql/next"
plugins:
- typescript
- typescript-operations
- typescript-urql
The second issue here is that you are missing Suspense boundaries, so during SSR it throws and never keeps the import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import GqlProvider from "./GqlProvider";
import { Suspense } from "react";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body className={inter.className}>
<GqlProvider>
<Suspense>
{children}
</Suspense>
</GqlProvider>
</body>
</html>
);
} |
I'm experiencing the same issue. I tried the above solution but it didn't resolve the problem. Strangely enough, what resolves the infinite fetch problem for me is removing |
@michaelzadra1 That sounds like a different issue |
Going to close this issue out, feel free to create a new one for the edge issue! 🙌 will need an accompanying reproduction |
Describe the bug
When I use the Provider for urql client, it seems that it is infinitely called when any query is activated.
I prepared the reproducible example code: https://github.com/shkim/urql-next13-error
Remarkable files are:
src/app/GqlProvider.tsx
src/app/layout.tsx
src/app/query/page.tsx
src/graphql/index.ts
src/graphql/documents.tsx
src/graphql/generated.tsx file is generated with graphql-codegen
it can be regenerated by "graphql-codegen --config gql-config.yml"
Thank you.
Reproduction
https://github.com/shkim/urql-next13-error
Urql version
@urql/next 1.1.0 (latest at the moment)
Validations
The text was updated successfully, but these errors were encountered: