gatsby@5.12.4
gatsby-source-prismic@6.0.1
gatsby-plugin-prismic-previews@6.0.1
When we are previewing new (unpublished) content we are seeing the 404 page component for a moment or two before it redirects to the content template. Is there some way of preventing this?
404.js
import React from 'react';
import { withPrismicUnpublishedPreview } from 'gatsby-plugin-prismic-previews';
const PageNotFound = () => {
return (
<div className="pb-16 2xl:pb-32">
{/* Page markup... */}
</div>
);
};
export default withPrismicUnpublishedPreview(PageNotFound);
The component below is imported into gatsby-ssr.js and gatsby-browser.js.
wrapRootElement.js
import React from 'react';
import { PrismicPreviewProvider } from 'gatsby-plugin-prismic-previews';
import { repositoryConfigs } from './prismicPreviews';
export const wrapRootElement = ({ element }) => (
<PrismicPreviewProvider repositoryConfigs={repositoryConfigs}>
{element}
</PrismicPreviewProvider>
);
prismicPreviews.js
import { linkResolver } from './utils/linkResolver';
import ArticleTemplate from './templates/post';
import StoryTemplate from './templates/story';
export const repositoryConfigs = [
{
repositoryName: 'myRepo',
linkResolver,
componentResolver: {
article: ArticleTemplate,
story: StoryTemplate,
},
},
];
Thanks!!