Unobserve prefetched elements
See original GitHub issueDepending on the number of links on a page, or if new links are added programmatically after the initial call. Both the query selector in the timeout method https://github.com/GoogleChromeLabs/quicklink/blob/master/src/index.mjs#L70, and/or the entries loop in the observer callback https://github.com/GoogleChromeLabs/quicklink/blob/master/src/index.mjs#L23, could be problematic for subsequent calls.
I think it would be worth to unobserve
elements that are already prefetched.
Additionally, instead of requiring additional calls to quicklink({ urls: [..]})
, which I think it is still needed to override the intersection observer; a mutationobserver.mjs
could be enabled through an option, or to keep the lib size down, expose it in dist and allow its default export to be passed as an option for runtime.
Let me know what you think and I can tackle these. 👍 Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top GitHub Comments
Perhaps we should rename this issue to reflect infinite scroll support? Now that quicklink is now technically unobserving processed elements, this issue has sparked a larger feature.
Thanks, @lukeed @addyosmani! I split the specific issue here. Apologies for lumping them together, infinite scroll is where the issue was most noticeable.
Closing this.