Skip to content

Fix prerender failure on shop product pages when COMING_SOON is enabled - #1

Draft
KieranSimpee with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-github-actions-build-job
Draft

Fix prerender failure on shop product pages when COMING_SOON is enabled#1
KieranSimpee with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-github-actions-build-job

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown

The build workflow failed during static prerender of /shop/[sku] because useCart() was called outside CartProvider in the COMING_SOON layout path. This PR aligns provider scope so commerce components remain context-safe in production prerender.

  • Root cause

    • RootLayout only wrapped the non-COMING_SOON branch with CartProvider.
    • /shop/[sku] renders AddToCartButton, which calls useCart(), causing prerender to throw.
  • Change

    • Move CartProvider up to wrap both layout branches in src/app/layout.tsx.
    • Keep existing layout structure and behavior otherwise unchanged.
  • Impact

    • Prevents useCart must be used within CartProvider during /shop/[sku] prerender.
    • Restores successful static generation for product pages under production COMING_SOON defaults.
<body className={`${montserrat.variable} font-sans`}>
  <CartProvider>
    {COMING_SOON ? children : <ContentStudioShell>{/* ... */}</ContentStudioShell>}
  </CartProvider>
</body>

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shortkey Ready Ready Preview, Comment Jul 17, 2026 4:11am

Copilot AI changed the title [WIP] Fix failing GitHub Actions job build Fix prerender failure on shop product pages when COMING_SOON is enabled Jul 17, 2026
Copilot AI requested a review from KieranSimpee July 17, 2026 04:01
@KieranSimpee
KieranSimpee requested a review from Copilot July 17, 2026 04:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a production static prerender failure on /shop/[sku] when COMING_SOON is enabled by ensuring commerce components that call useCart() are always rendered within CartProvider in the root app layout.

Changes:

  • Moves CartProvider in RootLayout so the COMING_SOON branch is also wrapped, preventing useCart must be used within CartProvider during prerender.
  • Keeps the existing COMING_SOON vs. ContentStudioShell layout branching structure while adjusting provider placement.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/app/layout.tsx Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/app/layout.tsx
Comment on lines 38 to 41
{COMING_SOON ? (
children
<CartProvider>{children}</CartProvider>
) : (
<ContentStudioShell>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants