ampproject / ampproject/amphtml

[amp-bind] amp-list evaluation does not wait for amp-state's src request to be resolved

Open
#11,998 8 comments 4 reactions 0 assignees View on GitHub
P2: Soon Stale Type: Bug WG: runtime
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

Bindings are evaluated when an amp-list template is rendered. However, these bindings don't wait until an amp-state's remote src has been resolved (which they should to ensure an deterministic behavior).

**Example:**

An amp-state element using a JSON endpoint:
```

```

The amp-list binds an element to the amp-state:
```


{{count}}



```

This results in a race-condition, where the text is either `null` or `123` depending on whether the amp-state has already been resolved or not.

I noticed this while working on this sample: https://ampbyexample.com/advanced/favorite_button/

//cc @choumx @ericlindley-g

Contributor guide

Open the contributing guide

Research direction

The report identifies amp-list template rendering and amp-state remote src resolution as the relevant entry points. Start by tracing how bindings are evaluated relative to the amp-state request in the provided example. Done means the binding waits for the remote state and produces deterministic output instead of null or 123 depending on timing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.