Open
Conversation
- Code-split ModelViewer into a lazy-loaded chunk via React.lazy - Add loading="lazy" and reveal="interaction" for non-hero models - Preload hero GLB asset via react-dom preload() for early fetch - Wrap model-viewer in sized div to avoid style type conflicts - Add noSwipingSelector for model-viewer in slider to prevent drag conflicts - Move cube icon to top-right corner
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.
Summary
ModelViewersupport to render 3D product models (Model3dmedia type)ExternalVideosupport to render embedded YouTube/Vimeo videossrc— Shopify'sModelViewerblindly pickssources[0], which can be a USDZ (ZIP) file causing a JSON parse error<model-viewer>— it has no intrinsic dimensions and collapses without set width/heightnoSwipingSelectorformodel-viewerin slider to prevent drag conflictsPerformance optimizations
ModelViewerinto a lazy-loaded chunk viaReact.lazy()— zero bundle cost on pages without 3D modelsloading="lazy"+reveal="interaction"for non-hero models — defer GLB fetch and GPU renderingpreload()hero GLB asset viareact-domfor early parallel fetchsizeshints to product media imagesQuickshop fix
fixedHeightprop to disable SwiperautoHeightin quickshop modal, preventing nav buttons from jumping between slides of different heightsFiles changed
app/components/product-media/model-utils.ts— new helper that reorders sources (GLB first, USDZ asios-src)app/components/product-media/model-viewer-item.tsx— new lazy-loaded wrapper for ModelViewerapp/components/product-media/media-item.tsx— addMODEL_3DandEXTERNAL_VIDEOrendering with lazy loading + preloadapp/components/product-media/media-zoom.tsx— same branches in zoom modal + cube icon on thumbnailsapp/components/product-media/media-slider.tsx— cube icon badge,noSwipingSelector,fixedHeightsupportapp/components/product-media/media-grid.tsx— click-to-zoom guard + responsivesizeshintsapp/components/product-media/index.tsx— threadfixedHeightpropapp/components/product-card/quick-shop.tsx— passfixedHeightto ProductMedia