diff --git a/mac/Sources/CodeBurnMenubar/Views/AgentTabStrip.swift b/mac/Sources/CodeBurnMenubar/Views/AgentTabStrip.swift index e4522dd..cb0ad1c 100644 --- a/mac/Sources/CodeBurnMenubar/Views/AgentTabStrip.swift +++ b/mac/Sources/CodeBurnMenubar/Views/AgentTabStrip.swift @@ -25,9 +25,9 @@ struct AgentTabStrip: View { } } - /// Drive tab visibility and per-tab cost labels from the *all-provider* payload (today), - /// not the currently selected provider's payload. Without this, switching to Codex (which - /// has no data) would hide every other tab including Claude. + /// Drive tab VISIBILITY from the all-provider today payload so tabs don't disappear + /// when switching periods or to a provider with no data. Cost values come from + /// store.payload (the selected period) via cost(for:). private var allProvidersToday: MenubarPayload { store.todayPayload ?? store.payload } @@ -46,13 +46,16 @@ struct AgentTabStrip: View { } } + /// Cost for the selected period, not pinned to today. The hero shows payload.current.cost, + /// so these tabs must match. Tab VISIBILITY is still driven by todayPayload (via + /// visibleFilters) so that tabs don't disappear when switching periods. private func cost(for filter: ProviderFilter) -> Double? { switch filter { case .all: - return allProvidersToday.current.cost + return store.payload.current.cost default: let key = filter.rawValue.lowercased() - return allProvidersToday.current.providers[key] + return store.payload.current.providers[key] } } }