TimelineView not updating the flights in chapter 15

I think the TimelineView in chapter 15 is not working quite right. It’s not updating the flight list. Maybe we have to use onChange and monitor the context.date and do some kind of load of the flights data the way refreshable() works.

Can you provide a bit more detail on what you’re seeing? When is the list not updating?

When you have TimelineView set to update every minute, its not updating the flight status so the times, like “6 minutes ago” are not updating. When you drag to refresh, the refreshable modifier is updating the flight status and so the relative time strings change.

I did it this way:
I passed the context.date as currentDate through FlightList to FlightRow:

      FlightList(
        flights: shownFlights.filter { $0.direction == .arrival },
        highlightedIds: $highlightedIds,
        currentDate: context.date
      )...

and in FlightRow:

var currentDate: Date

and in the HStack

      Text(relativeTimeFormatter.localizedString(for: flight.localTime, relativeTo: currentDate))

This forces the Views to be rerendered every time currentDate changes.

I have the same issue. The “Last updated 5:54 PM” text changes every minute as expected, but the relative time for each flight in the List rows (i.e. “in 46 min.”) does not update until you scroll away from the row and return, or manually refresh the list.