Keep Claude usage fetch outside state updater

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinwoo-H
2026-05-30 03:32:22 -07:00
co-authored by Orca
parent 4dd777785e
commit 265beb65aa
@@ -160,14 +160,12 @@ function ClaudeSwitcherMenu({
// Why: inactive-account usage is needed only for the explicit switcher
// expansion, so fetch it on that event instead of one render later.
const handleAccountsExpandedToggle = useCallback((): void => {
setAccountsExpanded((current) => {
const nextExpanded = !current
if (nextExpanded) {
void fetchInactiveClaudeAccountUsage()
}
return nextExpanded
})
}, [fetchInactiveClaudeAccountUsage])
const nextExpanded = !accountsExpanded
setAccountsExpanded(nextExpanded)
if (nextExpanded) {
void fetchInactiveClaudeAccountUsage()
}
}, [accountsExpanded, fetchInactiveClaudeAccountUsage])
const handleSelectAccount = async (accountId: string | null): Promise<void> => {
if (isSwitching) {