ampproject / ampproject/amphtml
[amp-bind] amp-list evaluation does not wait for amp-state's src request to be resolved
- 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:
```
```
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
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