Hotfix refreshing when switching tabs

This commit is contained in:
Justin Edmund 2023-06-18 16:34:54 -07:00
parent 3825be8866
commit 652df5f2b9

View file

@ -351,7 +351,8 @@ const Party = (props: Props) => {
// Methods: Navigating with segmented control // Methods: Navigating with segmented control
function segmentClicked(event: React.ChangeEvent<HTMLInputElement>) { function segmentClicked(event: React.ChangeEvent<HTMLInputElement>) {
const path = [ const path = [
router.asPath.split('/').filter((el) => el != '')[1], // Enable when using Next.js Router
// router.asPath.split('/').filter((el) => el != '')[1],
event.target.value, event.target.value,
].join('/') ].join('/')
@ -369,7 +370,10 @@ const Party = (props: Props) => {
break break
} }
router.replace(path, undefined, { shallow: true }) // Ideally, we would use the Next.js Router to replace the URL,
// but something about shallow routing isn't working so the page is refreshing
// router.replace(path, undefined, { shallow: true })
history.pushState({}, '', path)
} }
// Render: JSX components // Render: JSX components