debug: trips navigation lifecycle logging
This commit is contained in:
@@ -27,8 +27,11 @@ final class TripsViewModel {
|
||||
error = nil
|
||||
|
||||
do {
|
||||
trips = try await api.getTrips()
|
||||
let fetched = try await api.getTrips()
|
||||
print("[TRIPS] loadTrips: fetched \(fetched.count) trips")
|
||||
trips = fetched
|
||||
} catch {
|
||||
print("[TRIPS] loadTrips ERROR: \(error)")
|
||||
self.error = error.localizedDescription
|
||||
}
|
||||
isLoading = false
|
||||
@@ -37,8 +40,11 @@ final class TripsViewModel {
|
||||
func refresh() async {
|
||||
isLoading = true
|
||||
do {
|
||||
trips = try await api.getTrips()
|
||||
let fetched = try await api.getTrips()
|
||||
print("[TRIPS] refresh: fetched \(fetched.count) trips")
|
||||
trips = fetched
|
||||
} catch {
|
||||
print("[TRIPS] refresh ERROR: \(error)")
|
||||
self.error = error.localizedDescription
|
||||
}
|
||||
isLoading = false
|
||||
|
||||
@@ -7,6 +7,7 @@ struct PastTripsSection: View {
|
||||
let namespace: Namespace.ID
|
||||
|
||||
var body: some View {
|
||||
let _ = { print("[TRIPS] PastTripsSection body — trips=\(trips.count) ids=\(trips.map(\.id))") }()
|
||||
if !trips.isEmpty {
|
||||
Section {
|
||||
ScrollView(.horizontal) {
|
||||
|
||||
@@ -37,6 +37,12 @@ struct TripsHomeView: View {
|
||||
}
|
||||
}
|
||||
.background(Color.canvas)
|
||||
.onAppear {
|
||||
print("[TRIPS] TripsHomeView onAppear — trips=\(vm.trips.count) upcoming=\(vm.upcomingTrips.count) past=\(vm.pastTrips.count) isLoading=\(vm.isLoading)")
|
||||
}
|
||||
.onChange(of: vm.trips.count) { old, new in
|
||||
print("[TRIPS] trips count changed \(old) → \(new)")
|
||||
}
|
||||
.toolbar {
|
||||
// Custom expanded title — Wishlist pattern
|
||||
ToolbarItem(placement: .title) {
|
||||
|
||||
@@ -8,6 +8,7 @@ struct UpcomingTripsPageView: View {
|
||||
@Namespace private var namespace
|
||||
|
||||
var body: some View {
|
||||
let _ = { print("[TRIPS] UpcomingTripsPageView body — trips=\(trips.count) ids=\(trips.map(\.id))") }()
|
||||
if trips.isEmpty {
|
||||
// No upcoming trips — show a prompt
|
||||
VStack(spacing: 16) {
|
||||
@@ -30,6 +31,8 @@ struct UpcomingTripsPageView: View {
|
||||
TripPlaceholderView(trip: trip)
|
||||
.navigationTransition(
|
||||
.zoom(sourceID: trip.id, in: namespace))
|
||||
.onAppear { print("[TRIPS] detail onAppear: \(trip.name)") }
|
||||
.onDisappear { print("[TRIPS] detail onDisappear: \(trip.name)") }
|
||||
} label: {
|
||||
TripImageView(url: trip.imageURL, fallbackName: trip.name)
|
||||
.overlay(alignment: .bottomLeading) {
|
||||
|
||||
Reference in New Issue
Block a user