Skip to content

Commit 7a7a82d

Browse files
committed
feat(webapp): preserve admin tabs search query between Users and Organizations
1 parent 759214e commit 7a7a82d

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: improvement
4+
---
5+
6+
Preserve search string when switching between the Users and Organizations tabs in the admin dashboard.

apps/webapp/app/routes/admin.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Outlet } from "@remix-run/react";
1+
import { Outlet, useSearchParams } from "@remix-run/react";
22
import { typedjson } from "remix-typedjson";
33
import { LinkButton } from "~/components/primitives/Buttons";
44
import { Tabs } from "~/components/primitives/Tabs";
@@ -10,18 +10,22 @@ export const loader = dashboardLoader(
1010
);
1111

1212
export default function Page() {
13+
const [searchParams] = useSearchParams();
14+
const search = searchParams.get("search");
15+
const searchSuffix = search ? `?search=${encodeURIComponent(search)}` : "";
16+
1317
return (
1418
<div className="h-full w-full">
1519
<div className="flex items-center justify-between p-4">
1620
<Tabs
1721
tabs={[
1822
{
1923
label: "Users",
20-
to: "/admin",
24+
to: `/admin${searchSuffix}`,
2125
},
2226
{
2327
label: "Organizations",
24-
to: "/admin/orgs",
28+
to: `/admin/orgs${searchSuffix}`,
2529
},
2630
{
2731
label: "Concurrency",

0 commit comments

Comments
 (0)