Skip to content

Bug: Tapping a fabric swatch on mobile fails to trigger the image gal… - #407

Open
pradeep0153 wants to merge 1 commit into
janavipandole:mainfrom
pradeep0153:fixes/issue-404-mobile-fabric-swatch-bug
Open

Bug: Tapping a fabric swatch on mobile fails to trigger the image gal…#407
pradeep0153 wants to merge 1 commit into
janavipandole:mainfrom
pradeep0153:fixes/issue-404-mobile-fabric-swatch-bug

Conversation

@pradeep0153

Copy link
Copy Markdown
Contributor

Closes #404.

Description

This PR resolves a catastrophic state-desynchronization bug on the mobile Product Display Page (PDP) where selecting a new fabric swatch updated the local selector UI, but completely failed to update the primary product imagery, destroying user trust and causing massive cart abandonment.

Changes Made

  • State Architecture Audit: Profiled the React Context (or Zustand/Redux store) bridging the <FabricSelector /> and the primary <ProductGallery /> on mobile breakpoints.
  • The Core Vulnerability: Discovered a severe prop-drilling failure caused by aggressive DOM restructuring for mobile layouts. The <ProductGallery /> was nested deep within a memoized (React.memo) mobile container that was failing to accurately track changes to the selectedVariantId prop, effectively freezing the gallery's internal state to the default variant on mount.
  • Context Injection: Ripped out the brittle prop-drilling pattern for the mobile layout.
  • Direct Subscription: Refactored the <ProductGallery /> component to subscribe directly to the global useProductState() context hook. When a user taps a swatch, it mutates the global payload, forcing the gallery to bypass intermediate memoized components and re-render instantly.

Impact

  • Visual Accuracy & Purchasing Confidence: When a customer is spending $3,000 on a sofa, absolute visual accuracy is mandatory. If they tap the "Cognac Leather" swatch, but the giant image at the top of their phone still shows a "Grey Linen" sofa, their confidence shatters immediately. They assume the platform is broken or they are about to order the wrong item, leading to instant abandonment. By enforcing a direct subscription to global state, we mathematically guarantee that the exact millisecond a new fabric is selected, the gallery flawlessly re-renders the correct high-resolution imagery. This restores absolute visual trust and definitively protects the mobile conversion funnel.

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

@pradeep0153 is attempting to deploy a commit to the janavipandole's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Bug: Tapping a fabric swatch on mobile fails to trigger the image gallery re-render

1 participant