Giter VIP home page Giter VIP logo

Comments (3)

korompaiistvan avatar korompaiistvan commented on September 28, 2024

cache() (and use() too) seem to be unreleased React features that are not in React 18.2. I think their inclusion is a mistake.

See the RFC for use() which includes a description of cache()

from nextjs-blog-cms-sanity-v3.

korompaiistvan avatar korompaiistvan commented on September 28, 2024

these functions are added by the next runtime, see node_modules/next/types/index.d.ts

// Extend the React types with missing properties
declare module 'react' {
  // <html amp=""> support
  interface HtmlHTMLAttributes<T> extends React.HTMLAttributes<T> {
    amp?: string
  }

  // <link nonce=""> support
  interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
    nonce?: string
  }

  function use<T>(promise: Promise<T> | React.Context<T>): T
  function cache<T extends Function>(fn: T): T
}

it seems that through their close working relationship with the core react team they added these earlier to the experimental-edge runtime.

that means that they should work in theory (and they actually do on my end).

from nextjs-blog-cms-sanity-v3.

korompaiistvan avatar korompaiistvan commented on September 28, 2024

I could reproduce your issue by following the steps in the readme. It seems the issue is that these functions are only available with the nextjs appDir function that's currently in beta, and this template has moved off of it today.

so this was caused by #186 but the long-term fix would be to remove the use of use() and cache() from the OpenGraphPreview component.

a short-term workaround is to remove line 58-75 from the schemas/settings/index.ts file. those lines are:

    defineField({
      name: 'ogImage',
      title: 'Open Graph Image',
      description:
        'Used for social media previews when linking to the index page.',
      type: 'object',
      components: {
        input: OpenGraphInput as any,
      },
      fields: [
        defineField({
          name: 'title',
          title: 'Title',
          type: 'string',
          initialValue: demo.ogImageTitle,
        }),
      ],
    }),

this will remove the offending component from the settings page

from nextjs-blog-cms-sanity-v3.

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.