4
0
forked from crowetic/commerce

Fix dynamically import Modal component (#539)

* fix: dynamically import Modal component

fixes error "document is not defined" if the user decides to display a modal at the beginning (for ads, promotions, etc...)

* fix: remove spread operator

* remove top level modal import

* fix import path for Modal

Co-authored-by: Gonzalo Pozzo <gonzalo.pozzo4@gmail.com>
This commit is contained in:
Luis Orbaiceta 2021-11-24 15:00:33 +01:00 committed by GitHub
parent 683d309905
commit c8787865b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ import type { Category } from '@commerce/types/site'
import ShippingView from '@components/checkout/ShippingView'
import CartSidebarView from '@components/cart/CartSidebarView'
import { useAcceptCookies } from '@lib/hooks/useAcceptCookies'
import { Sidebar, Button, Modal, LoadingDots } from '@components/ui'
import { Sidebar, Button, LoadingDots } from '@components/ui'
import PaymentMethodView from '@components/checkout/PaymentMethodView'
import CheckoutSidebarView from '@components/checkout/CheckoutSidebarView'
@ -42,6 +42,11 @@ const FeatureBar = dynamic(
dynamicProps
)
const Modal = dynamic(
() => import('@components/ui/Modal'),
Object.assign(dynamicProps, {ssr: false})
)
interface Props {
pageProps: {
pages?: Page[]