Commit ede913d3 authored by isstuev's avatar isstuev

query change fix

parent 2cdc9bbd
...@@ -6,7 +6,6 @@ import { ...@@ -6,7 +6,6 @@ import {
TabPanels, TabPanels,
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import type { StyleProps } from '@chakra-ui/styled-system'; import type { StyleProps } from '@chakra-ui/styled-system';
import { pick } from 'lodash';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
...@@ -17,8 +16,6 @@ import useIsMobile from 'lib/hooks/useIsMobile'; ...@@ -17,8 +16,6 @@ import useIsMobile from 'lib/hooks/useIsMobile';
import RoutedTabsMenu from './RoutedTabsMenu'; import RoutedTabsMenu from './RoutedTabsMenu';
import useAdaptiveTabs from './useAdaptiveTabs'; import useAdaptiveTabs from './useAdaptiveTabs';
const PRESERVED_QUERY = [ 'network_type', 'network_sub_type' ];
const hiddenItemStyles: StyleProps = { const hiddenItemStyles: StyleProps = {
position: 'absolute', position: 'absolute',
top: '-9999px', top: '-9999px',
...@@ -52,8 +49,11 @@ const RoutedTabs = ({ tabs }: Props) => { ...@@ -52,8 +49,11 @@ const RoutedTabs = ({ tabs }: Props) => {
const handleTabChange = React.useCallback((index: number) => { const handleTabChange = React.useCallback((index: number) => {
const nextTab = tabs[index]; const nextTab = tabs[index];
router.query = { ...pick(router.query, PRESERVED_QUERY), tab: nextTab.id }; router.push(
router.push(router); { pathname: router.asPath.split('?')[0], query: { tab: nextTab.id } },
undefined,
{ shallow: true },
);
}, [ tabs, router ]); }, [ tabs, router ]);
return ( return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment