Skip to content

amp-list: race condition for a sequence of quick srcattr mutations. #25961

@samouri

Description

@samouri

summary

When hooking up amp-bind with amp-list where we mutate the bound [src] attribute, it is possible to enter a race condition where the rendered items are for the previous state.

Imagine a shopping cart with categories for women's/mens clothing:

  1. Default page to land on is women's clothing, and this endpoint takes 1s to resolve.
  2. User quickly clicks a the tab for men's clothing, and this only takes 200ms.

It is possible that the promise for loading data from (1) will end up resolving after (2). This leads to the jarring UX of having "Men" selected and yet seeing Women's clothing.

One can reproduce this in AMP Camp: https://camp.samples.amp.dev/product-listing?gender=women&category=shirts.

cc @choumx @morsssss

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions