From f86a1990985e855115817f050b0c9a477a6429b6 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 18 Jun 2023 16:49:11 -0700 Subject: [PATCH] Another hotfix for tab switching --- components/party/Party/index.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/party/Party/index.tsx b/components/party/Party/index.tsx index a03e910a..27fbf291 100644 --- a/components/party/Party/index.tsx +++ b/components/party/Party/index.tsx @@ -352,7 +352,8 @@ const Party = (props: Props) => { function segmentClicked(event: React.ChangeEvent) { const path = [ // Enable when using Next.js Router - // router.asPath.split('/').filter((el) => el != '')[1], + 'p', + router.asPath.split('/').filter((el) => el != '')[1], event.target.value, ].join('/') @@ -371,9 +372,10 @@ const Party = (props: Props) => { } // 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 + // but something about shallow routing isn't working so the page is refreshing. + // A consequence is that the browser push stack gets fucked // router.replace(path, undefined, { shallow: true }) - history.pushState({}, '', path) + history.pushState({}, '', '/' + path) } // Render: JSX components