Open
Description
I have a bug where If I use CartProvider, either in a Component or in Gatsby-ssr it will stop the HTML being rendered in Gatsby build. Removing the CartProvider fixes issue with content being shown. I have tried adding the CartProvider to gatsby-browser, however that breaks the build as it cant reference redux dispatch.
This is an example of Gatsby-ssr. Im using Gatsby 5, and use-shopping-cart version 3.1.6.
import * as React from 'react';
import { CartProvider } from 'use-shopping-cart';
const stripePromise = process.env.STRIPE_PUBLISHABLE_KEY;
const url = process.env.isDev ? 'http://localhost:8000' : '';
export const wrapPageElement = ({ element, props }) => {
return (
<CartProvider
mode='payment'
cartMode='checkout-session'
stripe={stripePromise}
successUrl={`${url}/success`}
cancelUrl={`${url}/shop`}
currency='gbp'
allowedCountries={['GB']}
billingAddressCollection={true}
loading={element}
>
{element}
</CartProvider>
);
};
Metadata
Metadata
Assignees
Labels
No labels