Giter Club home page Giter Club logo

Comments (4)

JoviDeCroock avatar JoviDeCroock commented on May 26, 2024

That's because this line should be importing from @urql/next.

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 GqlProvider alive meaning the state is constantly renewed so changing your layout to be the following should be the second fix.

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>
  );
}

from urql.

michaelzadra1 avatar michaelzadra1 commented on May 26, 2024

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 export const runtime = "edge"; from my Page components. There seems to be some issue with serving pages from edge fns w/ urql

from urql.

JoviDeCroock avatar JoviDeCroock commented on May 26, 2024

@michaelzadra1 That sounds like a different issue

from urql.

JoviDeCroock avatar JoviDeCroock commented on May 26, 2024

Going to close this issue out, feel free to create a new one for the edge issue! 🙌 will need an accompanying reproduction

from urql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.