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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user