ampproject / ampproject/amphtml

amp-script: binding can cause real DOM and virtual DOM to get out of sync

Open
#29,917 3 comments 0 reactions 0 assignees View on GitHub
Stale Type: Bug
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

I'm not sure there's a great solution to this one. I'm just reporting it as an issue in case someone sees a solution... and otherwise I'm just documenting the behavior.

If another process modifies an ``'s children, that change won't propagate to the virtual DOM - and the user's JavaScript will see stale data.

Here's one way in which this can happen:

```html

Will I change?

Change this and amp-script won't know
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the example using amp-script child bindings and AMP.setState, then trace how the real DOM and virtual DOM are updated. No source files or tests are named; done would require an agreed solution or documented behavior that keeps user JavaScript from observing stale data.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.