Create one shared intersection observer instead of one per link #30889
Unanswered
marcus13371337
asked this question in
Ideas / Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, gatsby community!
I read a nice blog post regarding the performance of the IntersectionObserver:
https://www.bennadel.com/blog/3954-intersectionobserver-api-performance-many-vs-shared-in-angular-11-0-5.htm
The results from that post suggest that using a shared intersection observer compared to creating one per element greatly improves performance (especially in Firefox).
Had a glance in the following file:
https://github.com/gatsbyjs/gatsby/blob/54d4721462b9303fed723fdcb15ac5d72e103778/packages/gatsby-link/src/index.js
It seems as every link creates its own intersection observer. Would it be possible to refactor this and use one shared intersection observer for all the links on a page? Or do you see any other drawbacks with that approach?
Beta Was this translation helpful? Give feedback.
All reactions