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:
<amp-state id="favorite"
credentials="include"
src="/favorite-with-count?RANDOM">
</amp-state>
The amp-list binds an element to the amp-state:
<amp-list ... src="/favorite-with-count?RANDOM">
<template type="amp-mustache">
<div class="favorite-count" [text]="favoriteWithCount.count ? favoriteWithCount.count : ''">{{count}}</div>
</template>
</amp-list>
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
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
nullor123depending 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