Skip to content
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

PrismicPreview failing typescript checks. #99

Open
bitscraps opened this issue Nov 5, 2024 · 1 comment
Open

PrismicPreview failing typescript checks. #99

bitscraps opened this issue Nov 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bitscraps
Copy link

bitscraps commented Nov 5, 2024

When upgrading from @prismicio/next 1.6.0 to 1.7.1 I now get the following typescript error when using PrismicPreview.

pages/_app.tsx:82:20 - error TS2786: 'PrismicPreview' cannot be used as a JSX component.
  Its return type 'Element | Promise<Element>' is not a valid JSX element.
    Type 'Promise<Element>' is missing the following properties from type 'ReactElement<any, any>': type, props, key

                  <PrismicPreview repositoryName={repositoryName} />

This is using the next pages folder versus using nexts new app folder.

The code for _app.tsx looks like the following with superfluous lines removed, this matches what is recommended via the documentation:

import React, { useCallback } from 'react'
import { ApolloProvider } from '@apollo/client'
import { PrismicPreview } from '@prismicio/next'
import { repositoryName } from '../prismicio'

function EolaApp({ Component, pageProps, err }: AppProps) {
  useSetupLocale()

  return (
    <>
      <ApolloProvider client={client}>
           <Component {...pageProps} err={err} />
           <PrismicPreview repositoryName={repositoryName} />
      </ApolloProvider>
    </>
  )
}

### Versions

- `@prismicio/next`: 1.7.1
@bitscraps bitscraps added the bug Something isn't working label Nov 5, 2024
Copy link

github-actions bot commented Nov 5, 2024

This issue has been labeled as a bug since it was created using the 🚨 Bug Report Template.

Hi there, thank you so much for the report!

Following our Maintenance Process, we will review your bug report and get back to you next Wednesday. To ensure a smooth review of your issue and avoid unnecessary delays, please make sure your issue includes the following:

  • Information about your environment and packages you use (Node.js version, package names and their versions, etc.)
    Feel free to attach a copy of your package.json file.
  • Any troubleshooting steps you already went through
  • A minimal reproduction of the issue, and/or instructions on how to reproduce it

If you have identified the cause of the bug described in your report and know how to fix it, you're more than welcome to open a pull request address it. Check out our quick start guide for a simple contribution process.

If you think your issue is a question (not a bug) and would like quicker support, please close this issue and forward it to an appropriate section on our community forum: https://community.prismic.io

- The Prismic Open-Source Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant