Skip to content

Commit 95b839a

Browse files
fix(mobile): a refresh error from an unreachable environment clears on reconnect
A pull-to-refresh with an environment down settles with its error, which shows as the list's load error and blocks loading on scroll. Its list queries re-run on reconnect, so clear that error when a new session is up. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a9bfba9 commit 95b839a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎apps/mobile/src/features/pull-requests/usePullRequestList.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,14 @@ export function usePullRequestList(targets: readonly ListTarget[]) {
166166
// Starting one kind of load clears the other, so at most one holds an error.
167167
const loadError = settledError(refresh) ?? settledError(page);
168168

169-
// A page asked for while an environment was unreachable fails at once; ask again once it is
170-
// back, since the error stops loading on scroll.
169+
// A page or refresh asked for while an environment was unreachable fails at once, and its
170+
// error stops loading on scroll. Once it is back, ask for the page again; a refresh's error is
171+
// stale by then because the list queries re-run on reconnect.
171172
// A listener alone does not compute the atom, so nothing would follow the connections.
172173
useAtomMount(sessionsFamily(scopeKey));
173174
useAtomSubscribe(sessionsFamily(scopeKey), () => {
174-
if (settledError(page) !== null && !refresh.waiting) registry.set(pageAtom, true);
175+
if (settledError(refresh) !== null) registry.set(refreshAtom, Atom.Reset);
176+
else if (settledError(page) !== null && !refresh.waiting) registry.set(pageAtom, true);
175177
});
176178

177179
const loadMore = (retry = false) => {

0 commit comments

Comments
 (0)