From ed0448e3de7cec3f2f05332f30c061aeef5c9f1e Mon Sep 17 00:00:00 2001 From: yutakobayashidev Date: Mon, 13 Jul 2026 21:54:02 +0900 Subject: [PATCH] fix: keep pagination lock effect-local --- src/features/posts/components/post-feed.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/features/posts/components/post-feed.tsx b/src/features/posts/components/post-feed.tsx index 0a8f906..be95e9d 100644 --- a/src/features/posts/components/post-feed.tsx +++ b/src/features/posts/components/post-feed.tsx @@ -6,9 +6,7 @@ import { PostCard } from './post-card' export function PostFeed({ request }: { request: FeedRequest | undefined }) { const query = usePostFeed(request) const sentinel = useRef(null) - const fetchingNextPage = useRef(query.isFetchingNextPage) const posts = query.data ? flattenPostPages(query.data.pages) : [] - fetchingNextPage.current = query.isFetchingNextPage useEffect(() => { if ( @@ -20,10 +18,11 @@ export function PostFeed({ request }: { request: FeedRequest | undefined }) { return } + let requested = false const observer = new IntersectionObserver( ([entry]) => { - if (entry?.isIntersecting && !fetchingNextPage.current) { - fetchingNextPage.current = true + if (entry?.isIntersecting && !requested) { + requested = true void query.fetchNextPage() } },