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 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-01-16 15:42:25 -06:00
parent 0130141f8a
commit 29942eee57

View File

@@ -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()