From 29942eee57236e823c5a80ec0c37c9ab0ea29b4c Mon Sep 17 00:00:00 2001 From: Trey t Date: Fri, 16 Jan 2026 15:42:25 -0600 Subject: [PATCH] fix(polls): prevent jarring reload when switching to My Trips tab - Only load polls once on initial view appearance, not every tab switch - Only show spinner when there's no existing data (first load) - Subsequent refreshes update content in place without showing spinner Co-Authored-By: Claude Opus 4.5 --- SportsTime/Features/Home/Views/HomeView.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SportsTime/Features/Home/Views/HomeView.swift b/SportsTime/Features/Home/Views/HomeView.swift index 14d24c2..e3ad8eb 100644 --- a/SportsTime/Features/Home/Views/HomeView.swift +++ b/SportsTime/Features/Home/Views/HomeView.swift @@ -411,6 +411,7 @@ struct SavedTripsListView: View { @State private var polls: [TripPoll] = [] @State private var isLoadingPolls = false + @State private var hasLoadedPolls = false @State private var showCreatePoll = false @State private var selectedPoll: TripPoll? @@ -437,6 +438,8 @@ struct SavedTripsListView: View { } .themedBackground() .task { + guard !hasLoadedPolls else { return } + hasLoadedPolls = true await loadPolls() } .refreshable { @@ -474,7 +477,7 @@ struct SavedTripsListView: View { } } - if isLoadingPolls { + if isLoadingPolls && polls.isEmpty { ProgressView() .frame(maxWidth: .infinity, alignment: .center) .padding()