mirror of
https://github.com/stablyai/orca.git
synced 2026-10-26 00:03:55 +00:00
Fetch Codex account usage on expand
This commit is contained in:
@@ -1090,11 +1090,17 @@ function CodexSwitcherMenu({
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (accountsExpanded) {
|
||||
void fetchInactiveCodexAccountUsage()
|
||||
}
|
||||
}, [accountsExpanded, fetchInactiveCodexAccountUsage])
|
||||
const handleAccountsExpandedToggle = useCallback((): void => {
|
||||
setAccountsExpanded((current) => {
|
||||
const nextExpanded = !current
|
||||
if (nextExpanded) {
|
||||
// Why: inactive-account usage is needed only for the explicit switcher
|
||||
// expansion, so fetch it on that event instead of one render later.
|
||||
void fetchInactiveCodexAccountUsage()
|
||||
}
|
||||
return nextExpanded
|
||||
})
|
||||
}, [fetchInactiveCodexAccountUsage])
|
||||
|
||||
const selectedRuntimeKey = getCodexStatusRuntimeKey(
|
||||
normalizeCodexStatusRuntimeTarget(accountState, toCodexStatusRuntimeTarget(codexTarget))
|
||||
@@ -1136,7 +1142,7 @@ function CodexSwitcherMenu({
|
||||
<DropdownMenuItem
|
||||
onSelect={(event) => {
|
||||
event.preventDefault()
|
||||
setAccountsExpanded((prev) => !prev)
|
||||
handleAccountsExpandedToggle()
|
||||
}}
|
||||
>
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-0.5 py-0.5 text-[12px]">
|
||||
|
||||
Reference in New Issue
Block a user