amp-script: binding can cause real DOM and virtual DOM to get out of sync
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 <amp-script>'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:
<amp-script layout="container" script="myscript">
<p [text]="myText">Will I change?</p>
</amp-script>
<button on="tap:AMP.setState({myText: 'I changed'})">Change this and amp-script won't know</button>
Solution: amp-bind should not be modifying elements within an amp-script :).
This is true! I did indeed document it :) Don't suppose it's a case where we'd want amp-bind to throw a warning or something, if amp-bind even has the ability to search its ancestor elements for an amp-script...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.