From c12b2ada284a62b67c396af8825b9c47e3707125 Mon Sep 17 00:00:00 2001 From: marcustyphoon Date: Tue, 8 Sep 2026 02:46:32 -0700 Subject: [PATCH 1/2] delay fetch until blog approaches viewport todo: maybe base rootmargin on previous post size idk --- src/features/mutual_checker/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/features/mutual_checker/index.js b/src/features/mutual_checker/index.js index e3165ceacf..87974fd1a3 100644 --- a/src/features/mutual_checker/index.js +++ b/src/features/mutual_checker/index.js @@ -127,7 +127,22 @@ const getIsFollowing = async (blogName, element) => { return following[blogName]; }; +const waitForIntersection = (element, rootMargin) => + new Promise(resolve => { + const observer = new IntersectionObserver( + entries => { + if (entries.some(({ isIntersecting }) => isIntersecting)) { + resolve(); + observer.disconnect(); + } + }, + { rootMargin }, + ); + observer.observe(element); + }); + const getIsFollowingYou = async (blogName, element) => { + followingYou[blogName] || await waitForIntersection(element, '100% 0px'); if (followingYou[blogName] === undefined) { const blog = [ await blogData(element), From 33c4104d5897f2e025682b3072b2c36f0f106799 Mon Sep 17 00:00:00 2001 From: marcustyphoon Date: Tue, 8 Sep 2026 02:46:39 -0700 Subject: [PATCH 2/2] test code --- src/features/mutual_checker/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/mutual_checker/index.js b/src/features/mutual_checker/index.js index 87974fd1a3..3c309da9d9 100644 --- a/src/features/mutual_checker/index.js +++ b/src/features/mutual_checker/index.js @@ -153,7 +153,7 @@ const getIsFollowingYou = async (blogName, element) => { followingYou[blogName] = blog ? Promise.resolve(blog.isFollowingYou) : apiFetch(`/v2/blog/${primaryBlogName}/followed_by`, { queryParams: { query: blogName } }) - .then(({ response: { followedBy } }) => followedBy) + .then(({ response: { followedBy } }) => true) .catch(() => Promise.resolve(false)); } return followingYou[blogName];