Skip to content

Conversation

@Madhavendrasinh-Vaghela

Fixes #40455

Description
This PR fixes a UI issue in the e-commerce example where all size options would momentarily flash as "unavailable" (crossed out) when switching between shirt colors.

Motivation
When a user selects a different color, the application fetches the size data for that color asynchronously. During this network request, the sizes object is undefined. The previous logic !shirts[selected.id].sizes['SIZE'] evaluated to true during this loading and undefined state, causing the UI to incorrectly mark all sizes as unavailable.

Changes
Updated the [class] binding logic for all size options in
examples/bind/ecommerce.amp.html.

  • Old Logic: Checked only for the absence of the specific size.
  • New Logic: Adds a guard check shirts[selected.id].sizes && ... to ensure the sizes data exists before determining if a specific size is unavailable.

Verification
1.Open
examples/bind/ecommerce.amp.html .

  1. Select a different color (e.g., "Brown").

  2. Observe that size options remain in their neutral state during the fetch and update correctly once data is loaded, without flashing the "unavailable" style.

@CLAassistant
Copy link

CLAassistant commented Dec 25, 2025

CLA assistant check
All committers have signed the CLA.

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.

Optimize the shopping cart page by avoiding the first flash after user interaction.

2 participants