Revert AgentTabStrip to original todayPayload behavior
Some checks are pending
CI / semgrep (push) Waiting to run

This commit is contained in:
iamtoruk 2026-04-25 01:59:51 +02:00 committed by AgentSeal
parent d7c92225e5
commit e2254e9237

View file

@ -25,9 +25,9 @@ struct AgentTabStrip: View {
} }
} }
/// Drive tab VISIBILITY from the all-provider today payload so tabs don't disappear /// Drive tab visibility and per-tab cost labels from the *all-provider* payload (today),
/// when switching periods or to a provider with no data. Cost values come from /// not the currently selected provider's payload. Without this, switching to Codex (which
/// store.payload (the selected period) via cost(for:). /// has no data) would hide every other tab including Claude.
private var allProvidersToday: MenubarPayload { private var allProvidersToday: MenubarPayload {
store.todayPayload ?? store.payload store.todayPayload ?? store.payload
} }
@ -46,16 +46,13 @@ 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? { private func cost(for filter: ProviderFilter) -> Double? {
switch filter { switch filter {
case .all: case .all:
return store.payload.current.cost return allProvidersToday.current.cost
default: default:
let key = filter.rawValue.lowercased() let key = filter.rawValue.lowercased()
return store.payload.current.providers[key] return allProvidersToday.current.providers[key]
} }
} }
} }