ampproject / ampproject/amphtml
Bound values not updating within amp-render
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
I'm trying to implement a version of the [Favorite Button example](https://amp.dev/documentation/examples/interactivity-dynamic-content/favorite_button/) using the newer `amp-render` component rather than `amp-list` with its `single-item` workaround.
Note that the button itself (`input type="submit"`) has a bound `class` attribute.
However, when using `amp-render`, these bound values do not update, despite successful XHR and `AMP.setState` actions taking place.
### Reproduction Steps
In my real-world code I've also changed the element to `button`, but the behaviour is the same whether it's `button` or `input`, and bound to `[class]`, `[text]`, `[value]`, or anything else: the binds simply do not update.
Simply change the `amp-list` to `amp-render` to duplicate:
```
```
### Relevant Logs
_No response_
### Browser(s) Affected
_No response_
### OS(s) Affected
_No response_
### Device(s) Affected
_No response_
### AMP Version Affected
_No response_
Contributor guide
Research direction
Start with the Favorite Button example and the amp-render reproduction, comparing it with the amp-list version. Trace the AMP.setState action and successful XHR through amp-render to determine why the [class], [text], and related bindings do not update; done means the reproduced bindings update after the state change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100