From b95b435e3091c2955b7ee7f1debef92028fe311a Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 20 Mar 2026 13:35:31 +0200 Subject: [PATCH] use isPending instead of isFetching for pagination guards isFetching blocks pagination during background refetches of cached data. isPending correctly targets the case we care about: no real data yet. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/screens/PostThread/index.tsx | 10 ++++++++-- src/state/queries/usePostThread/index.ts | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/screens/PostThread/index.tsx b/src/screens/PostThread/index.tsx index af2c432885..e6b1f4c638 100644 --- a/src/screens/PostThread/index.tsx +++ b/src/screens/PostThread/index.tsx @@ -363,7 +363,10 @@ export function PostThread({uri}: {uri: string}) { ) const onStartReached = () => { - if (thread.state.isFetching) return + // Don't paginate until we have real data. We intentionally don't check + // `isFetching` — background refetches shouldn't block pagination when + // we already have real cached data. + if (thread.state.isPending) return // can be true after `prepareForParamsUpdate` is called if (deferParents) return // prevent any state mutations if we know we're done @@ -375,7 +378,10 @@ export function PostThread({uri}: {uri: string}) { } const onEndReached = () => { - if (thread.state.isFetching) return + // Don't paginate until we have real data. We intentionally don't check + // `isFetching` — background refetches shouldn't block pagination when + // we already have real cached data. + if (thread.state.isPending) return // can be true after `prepareForParamsUpdate` is called if (deferParents) return // prevent any state mutations if we know we're done diff --git a/src/state/queries/usePostThread/index.ts b/src/state/queries/usePostThread/index.ts index ceb87fe47b..438551adb1 100644 --- a/src/state/queries/usePostThread/index.ts +++ b/src/state/queries/usePostThread/index.ts @@ -286,6 +286,7 @@ export function usePostThread({anchor}: {anchor?: string}) { /* * Copy in any query state that is useful */ + isPending: query.isPending, isFetching: query.isFetching, isPlaceholderData: query.isPlaceholderData, error: query.error,