From 906df6cffbe3069f151aa679eee124e4edd4fbce Mon Sep 17 00:00:00 2001 From: "Timothy Z." Date: Sun, 14 Jun 2026 20:03:01 +0300 Subject: [PATCH] refactor(General): simplify discord toggle --- src/routes/Settings/General/General.tsx | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/routes/Settings/General/General.tsx b/src/routes/Settings/General/General.tsx index 62bcdf783..a5b8409e1 100644 --- a/src/routes/Settings/General/General.tsx +++ b/src/routes/Settings/General/General.tsx @@ -62,18 +62,21 @@ const General = forwardRef(({ profile }: Props, ref) => { } }, [isTraktAuthenticated, profile.auth]); - const onToggleDiscord = useCallback(() => { - core.transport.dispatch({ - action: 'Ctx', - args: { - action: 'UpdateSettings', + const discordToggle = useMemo(() => ({ + checked: profile.settings.discordRpcEnabled === true, + onClick: () => { + core.transport.dispatch({ + action: 'Ctx', args: { - ...profile.settings, - discordRpcEnabled: !profile.settings.discordRpcEnabled + action: 'UpdateSettings', + args: { + ...profile.settings, + discordRpcEnabled: !profile.settings.discordRpcEnabled + } } - } - }); - }, [profile.settings]); + }); + } + }), [profile.settings]); useEffect(() => { if (dataExport.exportUrl) { @@ -150,11 +153,10 @@ const General = forwardRef(({ profile }: Props, ref) => { { discord.available && - }