From 17e601f4ab875ed3828c9d6c03c0a1ee195785a1 Mon Sep 17 00:00:00 2001 From: Salman Mohammed Date: Tue, 1 Apr 2025 08:37:01 -0400 Subject: [PATCH] fix: writing forcedConfig to localStorage 'session_sharing_config' (#1956) --- .../settings/session/SessionSharingSection.tsx | 9 ++++++++- .../settings_v2/sessions/SessionSharingSection.tsx | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ui/desktop/src/components/settings/session/SessionSharingSection.tsx b/ui/desktop/src/components/settings/session/SessionSharingSection.tsx index 3a97dc3e..5f78bc9b 100644 --- a/ui/desktop/src/components/settings/session/SessionSharingSection.tsx +++ b/ui/desktop/src/components/settings/session/SessionSharingSection.tsx @@ -18,7 +18,14 @@ export default function SessionSharingSection() { // Only load saved config from localStorage if the env variable is not provided. useEffect(() => { - if (!envBaseUrlShare) { + if (envBaseUrlShare) { + // If env variable is set, save the forced configuration to localStorage + const forcedConfig = { + enabled: true, + baseUrl: envBaseUrlShare, + }; + localStorage.setItem('session_sharing_config', JSON.stringify(forcedConfig)); + } else { const savedSessionConfig = localStorage.getItem('session_sharing_config'); if (savedSessionConfig) { try { diff --git a/ui/desktop/src/components/settings_v2/sessions/SessionSharingSection.tsx b/ui/desktop/src/components/settings_v2/sessions/SessionSharingSection.tsx index 66942bab..986442bc 100644 --- a/ui/desktop/src/components/settings_v2/sessions/SessionSharingSection.tsx +++ b/ui/desktop/src/components/settings_v2/sessions/SessionSharingSection.tsx @@ -19,7 +19,14 @@ export default function SessionSharingSection() { // Only load saved config from localStorage if the env variable is not provided. useEffect(() => { - if (!envBaseUrlShare) { + if (envBaseUrlShare) { + // If env variable is set, save the forced configuration to localStorage + const forcedConfig = { + enabled: true, + baseUrl: envBaseUrlShare, + }; + localStorage.setItem('session_sharing_config', JSON.stringify(forcedConfig)); + } else { const savedSessionConfig = localStorage.getItem('session_sharing_config'); if (savedSessionConfig) { try {