Skip to content

Commit

Permalink
Fix: page reload not working properly on Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Dec 31, 2024
1 parent b85a1e8 commit 6ee4037
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
19 changes: 10 additions & 9 deletions backend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLElement>) => {
Expand Down
21 changes: 11 additions & 10 deletions frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLElement>) => {
Expand Down

0 comments on commit 6ee4037

Please sign in to comment.