From 73f2940b305cac6702cc87086f944187ea5db585 Mon Sep 17 00:00:00 2001 From: Youssef Ayman <62572632+ELJoOker2004@users.noreply.github.com> Date: Mon, 17 Aug 2026 16:23:07 +0300 Subject: [PATCH] GameActivityToggle: fix Spotify toggle with multiple accounts (#1306) * GameActivityToggle: fix Spotify toggle with multiple accounts * change back aria-checked attribute to ariaChecked --- src/plugins/gameActivityToggle/index.tsx | 34 +++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/plugins/gameActivityToggle/index.tsx b/src/plugins/gameActivityToggle/index.tsx index 3024a91e1..071b4f768 100644 --- a/src/plugins/gameActivityToggle/index.tsx +++ b/src/plugins/gameActivityToggle/index.tsx @@ -86,8 +86,8 @@ function GameActivityToggleButton(props: UserAreaRenderProps) { const connectedAccounts = useStateFromStores([ConnectedAccountsStore], () => ConnectedAccountsStore.getAccounts()); const spotifyAccounts = connectedAccounts.filter(account => account.type === "spotify" && !account.revoked); - // The update is an API request which takes a bit to update the store, so we have to use our own state to reflect the change immediately - const [shareSpotifyActivity, setShareSpotifyActivity] = useState(spotifyAccounts[0]?.showActivity ?? false); + // The update is an API request which takes a bit to update the store, so keep local overrides to reflect changes immediately + const [spotifyActivityOverrides, setSpotifyActivityOverrides] = useState>({}); const buttonRef = useRef(null); @@ -103,12 +103,9 @@ function GameActivityToggleButton(props: UserAreaRenderProps) { onClick: () => ShowCurrentGame.updateSetting(old => !old) }; - // Only show switch if there's exactly one Spotify account connected. Otherwise it may lead to confusion - if (spotifyAccounts.length !== 1) + if (spotifyAccounts.length === 0) return