ampproject / ampproject/amphtml
[amp story shopping] Remove attachment templates when far from active page
Open
Component: amp-story-shopping
P2: Soon
Stale
Type: Feature Request
WG: stories
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
Attachment templates can potentially build a lot of dom that may not be necessary if the user navigates far away from them.
They should be removed from the dom at a certain distance and can be re-built if the user goes back.
### Alternatives Considered
Leave them in the dom.
It's okay to leave them but it keeps lots of un-needed dom in the document, which may slow down the experience.
### Additional Context
Distance can be read using a pattern used in [panning-media](https://github.com/processprocess/amphtml/blob/main/extensions/amp-story-panning-media/0.1/amp-story-panning-media.js#L153-L160)
Contributor guide
Assessment
This issue has not been assessed yet.