debug: trips navigation lifecycle logging
All checks were successful
Security Checks / dependency-audit (push) Successful in 13s
Security Checks / secret-scanning (push) Successful in 4s
Security Checks / dockerfile-lint (push) Successful in 3s

This commit is contained in:
Yusuf Suleman
2026-04-04 14:32:56 -05:00
parent 4621d4f606
commit 48b6522cf5
4 changed files with 18 additions and 2 deletions

View File

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

View File

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

View File

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

View File

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