From 23c0f8e383a588dc153a41994fdefeacafc1fc2f Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Thu, 18 Jan 2024 16:07:17 -0500 Subject: [PATCH] - update handleBeta Signed-off-by: Dave Richer --- client/src/App/App.jsx | 7 +------ client/src/utils/handleBeta.js | 6 ++++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index 7d396eef8..7a4f72c41 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -54,17 +54,12 @@ export function App({ }) { const client = useClient(); - // Handle The Beta Switch. - useEffect(() => { - handleBeta(); - }, []) - - useEffect(() => { if (!navigator.onLine) { setOnline(false); } + handleBeta(); checkUserSession(); }, [checkUserSession, setOnline]); diff --git a/client/src/utils/handleBeta.js b/client/src/utils/handleBeta.js index 428d4fb49..8a1fba468 100644 --- a/client/src/utils/handleBeta.js +++ b/client/src/utils/handleBeta.js @@ -24,12 +24,14 @@ export const handleBeta = () => { // Beta is enabled, but the current host name does start with beta. if (isBeta && !currentHostName.startsWith('beta')) { - window.location.href = `${window.location.protocol}//beta.${currentHostName}${window.location.pathname}${window.location.search}${window.location.hash}`; + const href= `${window.location.protocol}//beta.${currentHostName}${window.location.pathname}${window.location.search}${window.location.hash}`; + window.location.replace(href); } // Beta is not enabled, but the current host name does start with beta. else if (!isBeta && currentHostName.startsWith('beta')) { - window.location.href = `${window.location.protocol}//${currentHostName.replace('beta.', '')}${window.location.pathname}${window.location.search}${window.location.hash}`; + const href = `${window.location.protocol}//${currentHostName.replace('beta.', '')}${window.location.pathname}${window.location.search}${window.location.hash}`; + window.location.replace(href); } } export default handleBeta;