diff --git a/.server-changes/admin-tabs-preserve-search.md b/.server-changes/admin-tabs-preserve-search.md new file mode 100644 index 0000000000..7caaa64262 --- /dev/null +++ b/.server-changes/admin-tabs-preserve-search.md @@ -0,0 +1,6 @@ +--- +area: webapp +type: improvement +--- + +Preserve search string when switching between the Users and Organizations tabs in the admin dashboard. diff --git a/apps/webapp/app/routes/admin.tsx b/apps/webapp/app/routes/admin.tsx index 236c7f0580..1ac09efc76 100644 --- a/apps/webapp/app/routes/admin.tsx +++ b/apps/webapp/app/routes/admin.tsx @@ -1,4 +1,4 @@ -import { Outlet } from "@remix-run/react"; +import { Outlet, useSearchParams } from "@remix-run/react"; import { typedjson } from "remix-typedjson"; import { LinkButton } from "~/components/primitives/Buttons"; import { Tabs } from "~/components/primitives/Tabs"; @@ -10,6 +10,10 @@ export const loader = dashboardLoader( ); export default function Page() { + const [searchParams] = useSearchParams(); + const search = searchParams.get("search"); + const searchSuffix = search ? `?search=${encodeURIComponent(search)}` : ""; + return (