Fix prerender failure on shop product pages when COMING_SOON is enabled - #1
Draft
KieranSimpee with Copilot wants to merge 3 commits into
Draft
Fix prerender failure on shop product pages when COMING_SOON is enabled#1KieranSimpee with Copilot wants to merge 3 commits into
COMING_SOON is enabled#1KieranSimpee with Copilot wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Copilot
AI
changed the title
[WIP] Fix failing GitHub Actions job build
Fix prerender failure on shop product pages when Jul 17, 2026
COMING_SOON is enabled
There was a problem hiding this comment.
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
CartProviderinRootLayoutso theCOMING_SOONbranch is also wrapped, preventinguseCart must be used within CartProviderduring prerender. - Keeps the existing
COMING_SOONvs.ContentStudioShelllayout branching structure while adjusting provider placement.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
38
to
41
| {COMING_SOON ? ( | ||
| children | ||
| <CartProvider>{children}</CartProvider> | ||
| ) : ( | ||
| <ContentStudioShell> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
buildworkflow failed during static prerender of/shop/[sku]becauseuseCart()was called outsideCartProviderin theCOMING_SOONlayout path. This PR aligns provider scope so commerce components remain context-safe in production prerender.Root cause
RootLayoutonly wrapped the non-COMING_SOONbranch withCartProvider./shop/[sku]rendersAddToCartButton, which callsuseCart(), causing prerender to throw.Change
CartProviderup to wrap both layout branches insrc/app/layout.tsx.Impact
useCart must be used within CartProviderduring/shop/[sku]prerender.COMING_SOONdefaults.