Commit ede913d3 authored by isstuev's avatar isstuev

query change fix

parent 2cdc9bbd
......@@ -6,7 +6,6 @@ import {
TabPanels,
} from '@chakra-ui/react';
import type { StyleProps } from '@chakra-ui/styled-system';
import { pick } from 'lodash';
import { useRouter } from 'next/router';
import React, { useEffect, useState } from 'react';
......@@ -17,8 +16,6 @@ import useIsMobile from 'lib/hooks/useIsMobile';
import RoutedTabsMenu from './RoutedTabsMenu';
import useAdaptiveTabs from './useAdaptiveTabs';
const PRESERVED_QUERY = [ 'network_type', 'network_sub_type' ];
const hiddenItemStyles: StyleProps = {
position: 'absolute',
top: '-9999px',
......@@ -52,8 +49,11 @@ const RoutedTabs = ({ tabs }: Props) => {
const handleTabChange = React.useCallback((index: number) => {
const nextTab = tabs[index];
router.query = { ...pick(router.query, PRESERVED_QUERY), tab: nextTab.id };
router.push(router);
router.push(
{ pathname: router.asPath.split('?')[0], query: { tab: nextTab.id } },
undefined,
{ shallow: true },
);
}, [ tabs, router ]);
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