diff --git a/src/renderer/src/components/status-bar/StatusBar.tsx b/src/renderer/src/components/status-bar/StatusBar.tsx index 96bcb24da..6de4255c0 100644 --- a/src/renderer/src/components/status-bar/StatusBar.tsx +++ b/src/renderer/src/components/status-bar/StatusBar.tsx @@ -1211,8 +1211,12 @@ function CodexSwitcherMenu({ } }, []) - useEffect(() => { - if (accountsExpanded) { + const handleAccountsExpandedToggle = useCallback((): void => { + const nextExpanded = !accountsExpanded + setAccountsExpanded(nextExpanded) + 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() } }, [accountsExpanded, fetchInactiveCodexAccountUsage]) @@ -1257,7 +1261,7 @@ function CodexSwitcherMenu({ { event.preventDefault() - setAccountsExpanded((prev) => !prev) + handleAccountsExpandedToggle() }} >