From 6ee4037d2f3adb1da1bed26ae0892bd1c40cd2ec Mon Sep 17 00:00:00 2001 From: aelassas Date: Tue, 31 Dec 2024 18:14:56 +0100 Subject: [PATCH] Fix: page reload not working properly on Firefox --- backend/src/components/Header.tsx | 19 ++++++++++--------- frontend/src/components/Header.tsx | 21 +++++++++++---------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/backend/src/components/Header.tsx b/backend/src/components/Header.tsx index 81d764c0..74cf7288 100644 --- a/backend/src/components/Header.tsx +++ b/backend/src/components/Header.tsx @@ -106,16 +106,17 @@ const Header = ({ } const refreshPage = () => { - const params = new URLSearchParams(window.location.search) + // const params = new URLSearchParams(window.location.search) - if (params.has('l')) { - params.delete('l') - // window.location.href = window.location.href.split('?')[0] + ([...params].length > 0 ? `?${params}` : '') - window.location.replace(window.location.href.split('?')[0] + ([...params].length > 0 ? `?${params}` : '')) - } else { - // window.location.reload() - window.location.replace(window.location.href) - } + // if (params.has('l')) { + // params.delete('l') + // // window.location.href = window.location.href.split('?')[0] + ([...params].length > 0 ? `?${params}` : '') + // window.location.replace(window.location.href.split('?')[0] + ([...params].length > 0 ? `?${params}` : '')) + // } else { + // // window.location.reload() + // window.location.replace(window.location.href) + // } + navigate(0) } const handleLangMenuClose = async (event: React.MouseEvent) => { diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index e74b5c67..2deab549 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -192,16 +192,17 @@ const Header = ({ } const refreshPage = () => { - const params = new URLSearchParams(window.location.search) - - if (params.has('l')) { - params.delete('l') - // window.location.href = window.location.href.split('?')[0] + ([...params].length > 0 ? `?${params}` : '') - window.location.replace(window.location.href.split('?')[0] + ([...params].length > 0 ? `?${params}` : '')) - } else { - // window.location.reload() - window.location.replace(window.location.href) - } + // const params = new URLSearchParams(window.location.search) + + // if (params.has('l')) { + // params.delete('l') + // // window.location.href = window.location.href.split('?')[0] + ([...params].length > 0 ? `?${params}` : '') + // window.location.replace(window.location.href.split('?')[0] + ([...params].length > 0 ? `?${params}` : '')) + // } else { + // // window.location.reload() + // window.location.replace(window.location.href) + // } + navigate(0) } const handleLangMenuClose = async (event: React.MouseEvent) => {