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