Repository navigation
chore: sync nextjs template with example - #3926
Merged
Merged
Conversation
fredericoo
force-pushed
the
fb-update-nextjs-template-cart
branch
from
August 6, 2026 10:49
0f2ef5c to
523ed72
Compare
Assisted-By: devx/c4e58df2-7ec2-41dc-960e-461d976f5ab0
Assisted-By: devx/c4e58df2-7ec2-41dc-960e-461d976f5ab0
fredericoo
force-pushed
the
fb-update-nextjs-template-cart
branch
from
August 6, 2026 13:47
060c16a to
0b51850
Compare
fredericoo
marked this pull request as ready for review
August 6, 2026 13:49
Assisted-By: devx/93464ba5-5073-4a80-8430-e1b04505804d
graygilmore
reviewed
Aug 6, 2026
andguy95
approved these changes
Aug 6, 2026
andguy95
left a comment
Collaborator
There was a problem hiding this comment.
Top hatted template locally, looks to behave accordingly.
IgorOffline
pushed a commit
to IgorOffline/Shopify-hydrogen
that referenced
this pull request
Oct 10, 2026
* Sync Next.js template with example Assisted-By: devx/c4e58df2-7ec2-41dc-960e-461d976f5ab0 * Show account icon in Next.js template Assisted-By: devx/c4e58df2-7ec2-41dc-960e-461d976f5ab0 * docs: add nextjs agents md Assisted-By: devx/93464ba5-5073-4a80-8430-e1b04505804d * chore: pin preview version of hydrogen * chore: remove dependencies.md
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.
TL;DR: Updates the Next.js template to match the current example pattern for Cache Components, streamed app shell data, and Suspense-backed cart state.
Before
The root layout waited for cart and navigation data before rendering the template shell:
Cart UI read directly from
useCart, so initial cart loading was handled as local loading state rather than a Suspense boundary.After
The root layout is a static shell. Request-bound cart and navigation setup lives in
AppShell, which streams under Suspense:The cart seed is passed to
CartProvideras a promise, and cart surfaces that need resolved cart data useuseSuspenseCart().What this changes
cacheComponentsfor the Next.js template.AppShellserver component for request-bound cart and nav setup.CartProviderso the shell can stream.useSuspenseCart()for full-cart reads.force-dynamicroute exports that are not compatible with Cache Components.cart_viewedonce per drawer open cycle instead of on every cart update while open.UX impact
The storefront shell can render before personalised cart data resolves. Loading states keep
main#main-contentand status text available so keyboard and assistive tech users do not lose page context during Suspense fallbacks.Out of scope
CollectionBrowse.tsxandstandard-actions.d.ts.@next/next/no-img-elementwarnings from the template image strategy.Risk
cart_viewedafter each in-drawer cart mutation, this changes that behaviour intentionally.How to Test
templates/nextjs, runpnpm dev.http://localhost:3000./cartand confirm the cart route renders with the same cart state./collections, a collection page,/search, and a product page to confirm the streamed shell still wraps each route.