mirror of
https://github.com/stablyai/orca.git
synced 2026-10-22 00:03:47 +00:00
Keep Claude usage fetch outside state updater
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user