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

"uncaughtSuspenseError" error when previewing a draft document #546

Open
kb1995 opened this issue Dec 14, 2023 · 0 comments
Open

"uncaughtSuspenseError" error when previewing a draft document #546

kb1995 opened this issue Dec 14, 2023 · 0 comments
Labels

Comments

@kb1995
Copy link

kb1995 commented Dec 14, 2023

Versions

  • gatsby-source-prismic: ^6.0.1
  • gatsby-plugin-prismic-previews: ^6.0.1
  • gatsby: ^5.8.0
  • Node.js: 18

Steps to reproduce

I followed the documentation to upgrade to v6 - previews of already published documents work as expected, but draft documents are not working. I get the following error https://share.cleanshot.com/ZQKvmWtB

My repositoryConfig file looks like this:

import React from 'react';
import linkResolver from '@prismic/utils/linkResolver';

const HowToBuildPage = React.lazy(() => import('../../templates/howToBuild-template'));
const HowToDevelopPage = React.lazy(() => import('../../templates/howToDevelop-template'));
const ShowcasePost = React.lazy(() => import('../../templates/ShowcasePost/ShowcasePost'));
const BlogPost = React.lazy(() => import('../../templates/blogPost'));
const AcademyPost = React.lazy(() => import('../../templates/academyPost'));
const LandingPage = React.lazy(() => import('../../templates/landing'));
const AcademyLanding = React.lazy(() => import('../../templates/academyLanding'));
const Author = React.lazy(() => import('../../templates/author'));
const Category = React.lazy(() => import('../../templates/category'));
const PodcastEpisode = React.lazy(() => import('../../templates/podcastEpisode'));
const MarketplaceTypePage = React.lazy(() => import('../../templates/marketplaceTypePage'));
const FeatureHighlightPage = React.lazy(() => import('../../templates/featureHighlightPage'));
const LegalPage = React.lazy(() => import('../../templates/LegalPage/LegalPage'));

export const repositoryConfigs = [
  {
    repositoryName: process.env.GATSBY_PRISMIC_REPO_NAME,
    linkResolver,
    componentResolver: {
      how_to_build_page: HowToBuildPage,
      how_to_develop_page: HowToDevelopPage,
      showcase_post: ShowcasePost,
      blog_post: BlogPost,
      academy_post: AcademyPost,
      landing_page: LandingPage,
      academy_landing: AcademyLanding,
      person: Author,
      category: Category,
      podcast_episode: PodcastEpisode,
      marketplace_type_page: MarketplaceTypePage,
      feature_highlight_page: FeatureHighlightPage,
      legal_page: LegalPage,
    },
  },
];

If I remove the Lazy directive and just import the templates in the normal way, the error disappears

What is expected?

For the draft document to work as expected.

What is actually happening?

I get the above error.

@kb1995 kb1995 added the bug label Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant