Commit d1f71efb authored by isstuev's avatar isstuev

remove query params from tab navigation

parent 2c6b0b0f
......@@ -6,6 +6,7 @@ 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';
......@@ -16,6 +17,8 @@ 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',
......@@ -49,7 +52,7 @@ const RoutedTabs = ({ tabs }: Props) => {
const handleTabChange = React.useCallback((index: number) => {
const nextTab = tabs[index];
router.query.tab = nextTab.id;
router.query = { ...pick(router.query, PRESERVED_QUERY), tab: nextTab.id };
router.push(router);
}, [ tabs, router ]);
......
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