Skip to content

Commit

Permalink
🐛 fix undefined menu error (#1533)
Browse files Browse the repository at this point in the history
  • Loading branch information
michenly committed Dec 5, 2023
1 parent f352f16 commit d53b4ed
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .changeset/olive-schools-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'skeleton': patch
'@shopify/cli-hydrogen': patch
'@shopify/create-hydrogen': patch
---

🐛 fix undefined menu error
4 changes: 3 additions & 1 deletion templates/skeleton/app/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export function Footer({
}: FooterQuery & {shop: HeaderQuery['shop']}) {
return (
<footer className="footer">
<FooterMenu menu={menu} primaryDomainUrl={shop.primaryDomain.url} />
{menu && shop?.primaryDomain?.url && (
<FooterMenu menu={menu} primaryDomainUrl={shop.primaryDomain.url} />
)}
</footer>
);
}
Expand Down
23 changes: 13 additions & 10 deletions templates/skeleton/app/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ export function Layout({
<>
<CartAside cart={cart} />
<SearchAside />
<MobileMenuAside menu={header.menu} shop={header.shop} />
<Header header={header} cart={cart} isLoggedIn={isLoggedIn} />
<MobileMenuAside menu={header?.menu} shop={header?.shop} />
{header && <Header header={header} cart={cart} isLoggedIn={isLoggedIn} />}
<main>{children}</main>
<Suspense>
<Await resolve={footer}>
{(footer) => <Footer menu={footer.menu} shop={header.shop} />}
{(footer) => <Footer menu={footer?.menu} shop={header?.shop} />}
</Await>
</Suspense>
</>
Expand Down Expand Up @@ -94,12 +94,15 @@ function MobileMenuAside({
shop: HeaderQuery['shop'];
}) {
return (
<Aside id="mobile-menu-aside" heading="MENU">
<HeaderMenu
menu={menu}
viewport="mobile"
primaryDomainUrl={shop.primaryDomain.url}
/>
</Aside>
menu &&
shop?.primaryDomain?.url && (
<Aside id="mobile-menu-aside" heading="MENU">
<HeaderMenu
menu={menu}
viewport="mobile"
primaryDomainUrl={shop.primaryDomain.url}
/>
</Aside>
)
);
}

0 comments on commit d53b4ed

Please sign in to comment.