From 909f6e8eb577d825f1d28a8af855a92b63cf65df Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Thu, 18 Jan 2024 15:55:23 -0500 Subject: [PATCH 1/2] - add a reload on beta switch Signed-off-by: Dave Richer --- client/src/App/App.jsx | 6 ++---- client/src/utils/handleBeta.js | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index 4f8695240..f1ead3cb8 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -47,10 +47,6 @@ export function App({bodyshop, checkUserSession, currentUser, online, setOnline} const [listenersAdded, setListenersAdded] = useState(false) const {t} = useTranslation(); - // Handle The Beta Switch. - useEffect(() => { - handleBeta(); - }, []) useEffect(() => { if (!navigator.onLine) { @@ -58,6 +54,8 @@ export function App({bodyshop, checkUserSession, currentUser, online, setOnline} } checkUserSession(); + + handleBeta(); }, [checkUserSession, setOnline]); //const b = Grid.useBreakpoint(); diff --git a/client/src/utils/handleBeta.js b/client/src/utils/handleBeta.js index 16b865161..7fe39fa33 100644 --- a/client/src/utils/handleBeta.js +++ b/client/src/utils/handleBeta.js @@ -25,13 +25,13 @@ 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}`; - window.reload(); + window.location.reload(); } // 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}`; - window.reload(); + window.location.reload(); } } export default handleBeta; From 43621bc6a230ca4afb119ba39499aab8186640ac Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Thu, 18 Jan 2024 15:57:15 -0500 Subject: [PATCH 2/2] - add a reload on beta switch Signed-off-by: Dave Richer --- client/src/utils/handleBeta.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/utils/handleBeta.js b/client/src/utils/handleBeta.js index 7fe39fa33..8a1fba468 100644 --- a/client/src/utils/handleBeta.js +++ b/client/src/utils/handleBeta.js @@ -24,14 +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}`; - window.location.reload(); + 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}`; - window.location.reload(); + const href = `${window.location.protocol}//${currentHostName.replace('beta.', '')}${window.location.pathname}${window.location.search}${window.location.hash}`; + window.location.replace(href); } } export default handleBeta;