Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b93f004

Browse files
committedDec 3, 2024·
feat: keep search params when navigate to other tab
1 parent e33eaf6 commit b93f004

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎packages/insomnia/src/ui/components/tabs/tabList.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import _ from 'lodash';
22
import React, { useCallback, useEffect, useState } from 'react';
33
import { Button, DropIndicator, GridList, Menu, MenuItem, MenuTrigger, Popover, type Selection, useDragAndDrop } from 'react-aria-components';
4-
import { useFetcher, useNavigate, useParams } from 'react-router-dom';
4+
import { useFetcher, useNavigate, useParams, useSearchParams } from 'react-router-dom';
55

66
import { type ChangeBufferEvent, type ChangeType, database } from '../../../common/database';
77
import * as models from '../../../models/index';
@@ -51,6 +51,7 @@ export const OrganizationTabList = ({ showActiveStatus = true, currentPage = ''
5151

5252
const requestFetcher = useFetcher();
5353
const { organizationId, projectId } = useParams();
54+
const [searchParams] = useSearchParams();
5455

5556
const {
5657
changeActiveTab,
@@ -68,7 +69,8 @@ export const OrganizationTabList = ({ showActiveStatus = true, currentPage = ''
6869
if (keys !== 'all') {
6970
const key = [...keys.values()]?.[0] as string;
7071
const tab = tabList.find(tab => tab.id === key);
71-
tab?.url && navigate(tab?.url);
72+
// keep the search params when navigate to another tab
73+
tab?.url && navigate(`${tab?.url}?${searchParams.toString()}`);
7274
changeActiveTab(key);
7375
}
7476
};

0 commit comments

Comments
 (0)
Please sign in to comment.