Description
When switching between token accounts (e.g. multiple Claude session keys) in the menu bar dropdown, the usage card does not update to show the newly selected account's data. The menu continues displaying the previous account's usage until manually refreshed or the menu is closed and reopened.
Root cause
Two issues in StatusItemController+Menu.swift in the TokenAccountSwitcherView onSelect handler:
-
store.refresh() is silently dropped. The global refresh() method has a guard !self.isRefreshing else { return } gate. When the menu opens, scheduleOpenMenuRefresh already kicks off a refresh. If the user switches token accounts while that refresh is in-flight, the new store.refresh() call returns immediately without fetching data for the newly selected account.
-
No menu repopulation after async refresh. Even when the refresh does run, invalidateMenus() intentionally skips open menus ("Don't refresh menus while they're open"). The Codex account switcher handles this by explicitly calling refreshOpenMenuIfStillVisible after its async refresh completes, but the token account switcher did not.
Expected behavior
Switching token accounts should immediately fetch the new account's usage data and update the open menu in-place.
Environment
- CodexBar 0.24 (development)
- macOS 15
Description
When switching between token accounts (e.g. multiple Claude session keys) in the menu bar dropdown, the usage card does not update to show the newly selected account's data. The menu continues displaying the previous account's usage until manually refreshed or the menu is closed and reopened.
Root cause
Two issues in
StatusItemController+Menu.swiftin theTokenAccountSwitcherViewonSelecthandler:store.refresh()is silently dropped. The globalrefresh()method has aguard !self.isRefreshing else { return }gate. When the menu opens,scheduleOpenMenuRefreshalready kicks off a refresh. If the user switches token accounts while that refresh is in-flight, the newstore.refresh()call returns immediately without fetching data for the newly selected account.No menu repopulation after async refresh. Even when the refresh does run,
invalidateMenus()intentionally skips open menus ("Don't refresh menus while they're open"). The Codex account switcher handles this by explicitly callingrefreshOpenMenuIfStillVisibleafter its async refresh completes, but the token account switcher did not.Expected behavior
Switching token accounts should immediately fetch the new account's usage data and update the open menu in-place.
Environment