Skip to content

Token account switcher does not refresh menu with new account data #798

@Zeko369

Description

@Zeko369

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:

  1. 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.

  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedConfirmed backlog item or verified open bugarea:accountsMultiple accounts, account discovery, switchingbugSomething isn't workingpriority:mediumMedium priority: real issue or meaningful backlog item

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions