summaryrefslogtreecommitdiff
path: root/Hutch
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-13 17:41:34 -0500
committerChristian Cleberg <[email protected]>2026-04-13 17:41:34 -0500
commitb423f8a1cf3141d0b15ee899c1c5fe535ff982e9 (patch)
tree7cd72192d3d6f568e4c50860caa0cbc843b53811 /Hutch
parent30decf6d9b6b95277cbd8b8a7d9e23d9ce5413ca (diff)
downloadhutch-b423f8a1cf3141d0b15ee899c1c5fe535ff982e9.tar.gz
hutch-b423f8a1cf3141d0b15ee899c1c5fe535ff982e9.tar.bz2
hutch-b423f8a1cf3141d0b15ee899c1c5fe535ff982e9.zip
fix: suppress false "network request failed" error on ticket list scroll
When scrolling through a large tracker, SwiftUI's .task modifier cancels in-flight pagination requests as rows leave the screen. URLSession responds with URLError(-999), which was being surfaced to the user as "The network request failed. Please try again." — even though the cancellation is expected and benign. Guard against Task.isCancelled in the catch block so cancellations are silently ignored; isLoadingMore is still reset unconditionally so the next scroll attempt retries from the same cursor position. Fixes: https://todo.sr.ht/~ccleberg/hutch/61
Diffstat (limited to 'Hutch')
-rw-r--r--Hutch/Views/Tickets/TicketListViewModel.swift6
1 files changed, 5 insertions, 1 deletions
diff --git a/Hutch/Views/Tickets/TicketListViewModel.swift b/Hutch/Views/Tickets/TicketListViewModel.swift
index 0255798..30e90a7 100644
--- a/Hutch/Views/Tickets/TicketListViewModel.swift
+++ b/Hutch/Views/Tickets/TicketListViewModel.swift
@@ -341,7 +341,11 @@ final class TicketListViewModel {
hasMore = page.cursor != nil
reconcileSelectionWithLoadedTickets()
} catch {
- self.error = error.userFacingMessage
+ // Ignore cancellation errors — the SwiftUI .task modifier cancels in-flight
+ // requests when a row scrolls off-screen, which is expected behavior.
+ if !Task.isCancelled {
+ self.error = error.userFacingMessage
+ }
}
isLoadingMore = false