Fixes amp-story-shopping shopping tag not showing up on refresh when using remote data#37793
Conversation
|
Hey @gmajoulet! These files were changed: |
|
Very nice. This way the logic only runs if the tag exists. It removes null checks and the calltoinitialize will set the initial state of the tag. |
|
It would be helpful to rename this to |
|
Warning: disparity between this PR Percy build and its The Percy build for this PR was approved (either manually by a member of the AMP team, or automatically if there were no visual diffs). However, during a continuous integration step we generated another Percy build using the commit on the This is possibly an indication of an issue with this pull request, but could also be the result of flakiness. Please inspect the two builds < This PR's Percy build /
|
|
@ampproject/wg-approvers This appears to be a flake caused by amp-video which is unrelated to this PR. |
Closes #37749
There is an issue with the shopping data: the shopping tags subscribe to changes to the shopping data in the store service. However, it may not always be the case that the correct data will be loaded for the tag as sometimes the promises are unresolved, such as the case with remote data.
To fix this problem, we have added an additional conditional check for making sure that the data is loaded first before rendering. We have also refactored it so it only adds the shopping tag listeners after a valid shopping tag is created, not in the layout callback.