Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: keep list-page filters in the URL, following page layout refactor (#20891)
boojack573bdeb02103
diff --git a/frontend/src/react/components/IssueTable.test.tsx b/frontend/src/react/components/IssueTable.test.tsxindex 213de30053..a5826951ff 100644--- a/frontend/src/react/components/IssueTable.test.tsx+++ b/frontend/src/react/components/IssueTable.test.tsx@@ -1,7 +1,11 @@-import { render, screen } from "@testing-library/react";+import { fireEvent, render, screen } from "@testing-library/react";import { describe, expect, test, vi } from "vitest";import { emptySearchParams } from "./AdvancedSearch";-import { IssueSearchBar } from "./IssueTable";+import { IssueSearchBar, PresetButtons } from "./IssueTable";++vi.mock("@/react/hooks/useAppState", () => ({+ useCurrentUser: () => ({ email: "[email protected]" }),+}));vi.mock("react-i18next", () => ({initReactI18next: {@@ -39,5 +43,61 @@ describe("IssueSearchBar", () => {);expect(screen.getByPlaceholderText("common.filter")).toBeInTheDocument();+ expect(screen.getByTestId("time-range-picker").parentElement).toHaveClass(+ "flex-wrap",+ "gap-2"+ );+ });+});++describe("PresetButtons", () => {+ test("uses accessible tabs and updates the selected preset", () => {+ const onParamsChange = vi.fn();+ render(+ <PresetButtons+ params={{ query: "", scopes: [{ id: "status", value: "OPEN" }] }}+ onParamsChange={onParamsChange}+ />+ );++ expect(screen.getByRole("tablist")).toBeInTheDocument();++ const open = screen.getByRole("tab", { name: "issue.table.open" });+ expect(open).toHaveAttribute("aria-selected", "true");++ fireEvent.click(screen.getByRole("tab", { name: "issue.table.closed" }));+ expect(onParamsChange).toHaveBeenCalledWith({+ query: "",+ scopes: [+ { id: "status", value: "DONE", readonly: undefined },+ { id: "status", value: "CANCELED", readonly: undefined },+ ],+ });+ });++ test("keeps every tab unselected when the filter matches no preset", () => {+ const onParamsChange = vi.fn();+ render(+ <PresetButtons+ params={{+ query: "",+ scopes: [+ { id: "status", value: "OPEN" },+ { id: "approval", value: "APPROVED" },+ ],+ }}+ onParamsChange={onParamsChange}+ />+ );++ for (const tab of screen.getAllByRole("tab")) {+ expect(tab).toHaveAttribute("aria-selected", "false");+ }++ // A tab click from the no-match state must still apply its preset.+ fireEvent.click(+ screen.getByRole("tab", { name: "issue.waiting-approval" })+ );+ expect(onParamsChange).toHaveBeenCalled();});});diff --git a/frontend/src/react/components/IssueTable.tsx b/frontend/src/react/components/IssueTable.tsxindex fcfcb349e0..64a9c7d591 100644--- a/frontend/src/react/components/IssueTable.tsx+++ b/frontend/src/react/components/IssueTable.tsx@@ -32,6 +32,7 @@ import {SheetHeader,SheetTitle,} from "@/react/components/ui/sheet";+import { Tabs, TabsList, TabsTrigger } from "@/react/components/ui/tabs";import { Tooltip } from "@/react/components/ui/tooltip";import { useCurrentUser } from "@/react/hooks/useAppState";import { useEscapeKey } from "@/react/hooks/useEscapeKey";@@ -89,8 +90,8 @@ export function IssueSearchBar({scopeOptions: ScopeOption[];}) {return (- <div className="flex items-center md:gap-2">- <div className="flex-1 min-w-0">+ <div className="flex flex-wrap items-center gap-2">+ <div className="min-w-0 basis-80 grow"><AdvancedSearchparams={params}onParamsChange={onParamsChange}@@ -295,22 +296,75 @@ export function PresetButtons({);return (- <div className="shrink-0 flex border-b border-control-border">- {presets.map((preset) => (- <button- key={preset.value}- type="button"- className={cn(- "px-3 py-1.5 text-sm font-medium border-b-2 -mb-px transition-colors",- activePreset === preset.value- ? "border-accent text-accent"- : "border-transparent text-control-light hover:text-control"- )}- onClick={() => selectPreset(preset.value)}- >- {preset.label}- </button>- ))}+ <Tabs+ // `null` keeps the Tabs controlled with no active tab when the current+ // filter matches no preset; `undefined` would flip it to uncontrolled,+ // which auto-selects (and dead-locks) the first tab.+ value={activePreset || null}+ onValueChange={(value) => selectPreset(value as PresetValue)}+ >+ <TabsList className="relative overflow-x-auto border-b-0 pt-2 gap-x-0 after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-control-border hide-scrollbar">+ {presets.map((preset) => (+ <TabsTrigger+ key={preset.value}+ value={preset.value}+ className="z-10 border-b-2 border-transparent px-3 aria-selected:border-accent aria-selected:after:hidden focus-visible:ring-inset focus-visible:ring-offset-0"+ >+ {preset.label}+ </TabsTrigger>+ ))}+ </TabsList>+ </Tabs>+ );+}++// ===========================================================================+// IssueListPanel+// ===========================================================================++/** Bordered list surface shared by the issue dashboards: presets + rows. */+export function IssueListPanel({+ params,+ onParamsChange,+ isLoading,+ issues,+ selectedNames,+ onToggleSelection,+ showProject,+}: {+ params: SearchParams;+ onParamsChange: (params: SearchParams) => void;+ isLoading: boolean;+ issues: Issue[];+ selectedNames: Set<string>;+ onToggleSelection: (name: string) => void;+ showProject?: boolean;+}) {+ const { t } = useTranslation();++ return (+ <div className="overflow-hidden rounded-sm border border-block-border">+ <PresetButtons params={params} onParamsChange={onParamsChange} />+ {isLoading ? (+ <div className="flex justify-center py-8 text-control-light">+ <Loader2 className="size-5 animate-spin" />+ </div>+ ) : issues.length === 0 ? (+ <div className="flex justify-center py-8 text-control-light">+ {t("common.no-data")}+ </div>+ ) : (+ issues.map((issue) => (+ <IssueListItem+ key={issue.name}+ issue={issue}+ selected={selectedNames.has(issue.name)}+ onToggleSelection={onToggleSelection}+ highlightText={params.query}+ showProject={showProject}+ />+ ))+ )}</div>);}@@ -633,7 +687,8 @@ export const IssueListItem = memo(function IssueListItem({return (<div- className="flex items-start gap-x-2 px-3 sm:px-4 py-3 cursor-pointer border-b border-control-bg hover:bg-control-bg"+ data-slot="issue-list-item"+ className="flex items-start gap-x-2 px-4 py-3 cursor-pointer border-b border-block-border transition-colors last:border-b-0 hover:bg-control-bg/60"onClick={onRowClick}><divdiff --git a/frontend/src/react/components/ProjectPageLayout.tsx b/frontend/src/react/components/ProjectPageLayout.tsxindex 672a69dccc..afd6b94057 100644--- a/frontend/src/react/components/ProjectPageLayout.tsx+++ b/frontend/src/react/components/ProjectPageLayout.tsx@@ -87,7 +87,7 @@ type ProjectPageInfoProps = Omit<AlertProps, "onDismiss" | "variant"> & {};function ProjectPageInfo({ variant = "info", ...props }: ProjectPageInfoProps) {- return <Alert variant={variant} {...props} />;+ return <Alert role="note" variant={variant} {...props} />;}function ProjectPageContent({diff --git a/frontend/src/react/components/SelectionActionBar.test.tsx b/frontend/src/react/components/SelectionActionBar.test.tsxindex 53174a5ae6..e80cb06798 100644--- a/frontend/src/react/components/SelectionActionBar.test.tsx+++ b/frontend/src/react/components/SelectionActionBar.test.tsx@@ -91,6 +91,23 @@ describe("SelectionActionBar", () => {expect(container.textContent).toContain("Delete");});+ test("pins to the viewport above the visible main content", async () => {+ await act(async () => {+ root.render(+ <SelectionActionBar+ count={1}+ label="1 selected"+ allSelected={false}+ onToggleSelectAll={() => {}}+ actions={[]}+ />+ );+ });++ const bar = container.firstElementChild;+ expect(bar).toHaveClass("fixed", "bottom-6", "-translate-x-1/2");+ });+test("omits hidden actions and disables disabled actions", async () => {await act(async () => {root.render(diff --git a/frontend/src/react/components/SelectionActionBar.tsx b/frontend/src/react/components/SelectionActionBar.tsxindex 7d7bf2606d..4472d7bb44 100644--- a/frontend/src/react/components/SelectionActionBar.tsx+++ b/frontend/src/react/components/SelectionActionBar.tsx@@ -1,5 +1,10 @@import { type LucideIcon, MoreHorizontal } from "lucide-react";-import { useSyncExternalStore } from "react";+import {+ type CSSProperties,+ useLayoutEffect,+ useState,+ useSyncExternalStore,+} from "react";import { useTranslation } from "react-i18next";import { Button } from "@/react/components/ui/button";import { Checkbox } from "@/react/components/ui/checkbox";@@ -99,6 +104,42 @@ function useSelectionMaxVisible(): number {const DESTRUCTIVE_TONE_CLASS ="border-error text-error hover:bg-error/10 hover:text-error focus-visible:ring-error";+function useFixedPositionStyle(enabled: boolean): CSSProperties | undefined {+ const [style, setStyle] = useState<CSSProperties>();++ useLayoutEffect(() => {+ if (!enabled) return;++ const main = document.getElementById("bb-layout-main");+ if (!main) {+ setStyle({ left: "50%", maxWidth: "calc(100vw - 2rem)" });+ return;+ }++ const update = () => {+ const rect = main.getBoundingClientRect();+ setStyle({+ left: rect.left + rect.width / 2,+ maxWidth: Math.max(0, rect.width - 32),+ });+ };++ update();+ // Observing the main pane tracks sidebar collapse/expand as well as+ // window resizes; the extra resize listener covers pure horizontal+ // shifts where the pane's size stays the same.+ const observer = new ResizeObserver(update);+ observer.observe(main);+ window.addEventListener("resize", update);+ return () => {+ observer.disconnect();+ window.removeEventListener("resize", update);+ };+ }, [enabled]);++ return enabled ? style : undefined;+}+export function SelectionActionBar({count,label,@@ -110,6 +151,7 @@ export function SelectionActionBar({const { t } = useTranslation();const defaultMaxVisible = useSelectionMaxVisible();const maxVisible = maxVisibleActions ?? defaultMaxVisible;+ const fixedStyle = useFixedPositionStyle(count > 0);if (count <= 0) return null;@@ -120,11 +162,12 @@ export function SelectionActionBar({return (<divclassName={cn(- "sticky bottom-6 mx-auto w-fit max-w-full",+ "fixed bottom-6 w-fit max-w-full -translate-x-1/2","flex items-center gap-x-3 rounded-full bg-background border border-control-border shadow-lg","px-4 py-2",LAYER_SURFACE_CLASS)}+ style={fixedStyle}>{/* Leading cluster — never shrinks; stays visible on narrow viewportseven when the actions group has to scroll horizontally. */}diff --git a/frontend/src/react/components/WorkspacePageLayout.tsx b/frontend/src/react/components/WorkspacePageLayout.tsxindex b5d18618dd..d818363e5a 100644--- a/frontend/src/react/components/WorkspacePageLayout.tsx+++ b/frontend/src/react/components/WorkspacePageLayout.tsx@@ -137,7 +137,7 @@ function WorkspacePageInfo({variant = "info",...props}: WorkspacePageInfoProps) {- return <Alert variant={variant} {...props} />;+ return <Alert role="note" variant={variant} {...props} />;}export {diff --git a/frontend/src/react/hooks/useURLSearchParam.test.tsx b/frontend/src/react/hooks/useURLSearchParam.test.tsxnew file mode 100644index 0000000000..ed5332e33f--- /dev/null+++ b/frontend/src/react/hooks/useURLSearchParam.test.tsx@@ -0,0 +1,104 @@+import { act, renderHook } from "@testing-library/react";+import type { ReactNode } from "react";+import { MemoryRouter, useLocation, useNavigate } from "react-router-dom";+import { describe, expect, test } from "vitest";+import {+ createAdvancedSearchParser,+ useURLSearchParam,+} from "./useURLSearchParam";++describe("createAdvancedSearchParser", () => {+ test("keeps unsupported scope-looking tokens as query text", () => {+ const parse = createAdvancedSearchParser(["state", "label"]);++ expect(parse("state:ALL project:foo bar")).toEqual({+ query: "bar project:foo",+ scopes: [{ id: "state", value: "ALL" }],+ });+ });+});++describe("useURLSearchParam", () => {+ test("uses the URL as the source of truth across Back and Forward", async () => {+ const wrapper = ({ children }: { children: ReactNode }) => (+ <MemoryRouter+ initialEntries={["/items?q=open", "/items?q=closed"]}+ initialIndex={1}+ >+ {children}+ </MemoryRouter>+ );++ const { result } = renderHook(+ () => ({+ state: useURLSearchParam({ param: "q", defaultValue: "default" }),+ navigate: useNavigate(),+ }),+ { wrapper }+ );++ expect(result.current.state[0]).toBe("closed");+ await act(() => result.current.navigate(-1));+ expect(result.current.state[0]).toBe("open");+ await act(() => result.current.navigate(1));+ expect(result.current.state[0]).toBe("closed");+ });++ test("preserves unrelated parameters and explicit empty values", async () => {+ const wrapper = ({ children }: { children: ReactNode }) => (+ <MemoryRouter initialEntries={["/items?panel=activity"]}>+ {children}+ </MemoryRouter>+ );++ const { result } = renderHook(+ () => ({+ state: useURLSearchParam({ param: "q", defaultValue: "default" }),+ location: useLocation(),+ }),+ { wrapper }+ );++ act(() => result.current.state[1](""));+ expect(result.current.location.search).toBe("?panel=activity&q=");+ });++ test("omits a value equal to the default from the URL", () => {+ const wrapper = ({ children }: { children: ReactNode }) => (+ <MemoryRouter initialEntries={["/items?panel=activity&q=closed"]}>+ {children}+ </MemoryRouter>+ );++ const { result } = renderHook(+ () => ({+ state: useURLSearchParam({ param: "q", defaultValue: "default" }),+ location: useLocation(),+ }),+ { wrapper }+ );++ act(() => result.current.state[1]("default"));+ expect(result.current.location.search).toBe("?panel=activity");+ });++ test("skips navigation when the URL would not change", () => {+ const wrapper = ({ children }: { children: ReactNode }) => (+ <MemoryRouter initialEntries={["/items?q=closed"]}>+ {children}+ </MemoryRouter>+ );++ const { result } = renderHook(+ () => ({+ state: useURLSearchParam({ param: "q", defaultValue: "default" }),+ location: useLocation(),+ }),+ { wrapper }+ );++ const locationBefore = result.current.location;+ act(() => result.current.state[1]("closed"));+ expect(result.current.location).toBe(locationBefore);+ });+});diff --git a/frontend/src/react/hooks/useURLSearchParam.ts b/frontend/src/react/hooks/useURLSearchParam.tsnew file mode 100644index 0000000000..cc2156a82d--- /dev/null+++ b/frontend/src/react/hooks/useURLSearchParam.ts@@ -0,0 +1,128 @@+import {+ type Dispatch,+ type SetStateAction,+ useCallback,+ useMemo,+ useRef,+} from "react";+import { useSearchParams } from "react-router-dom";+import {+ buildSearchParamsBySearchText,+ buildSearchTextBySearchParams,+ type SearchParams,+} from "@/utils";++const identity = (value: string): string => value;++export const createAdvancedSearchParser =+ (allowedScopes: readonly string[]) =>+ (value: string): SearchParams => {+ const params = buildSearchParamsBySearchText(value);+ // A token that parses as a globally valid scope but isn't supported on+ // this page stays in the URL as plain query text instead of being+ // dropped (e.g. `project:foo` on a page without a project scope).+ const rejected = params.scopes+ .filter((scope) => !allowedScopes.includes(scope.id))+ .map((scope) => `${scope.id}:${scope.value}`);+ return {+ query: [params.query, ...rejected].filter(Boolean).join(" "),+ scopes: params.scopes.filter((scope) => allowedScopes.includes(scope.id)),+ };+ };++export const serializeAdvancedSearch = (value: SearchParams): string =>+ buildSearchTextBySearchParams(value);++/** Maps the legacy `?state=archived|all` URL format onto search scopes. */+export const legacyStateSearchParams = (state: unknown): SearchParams => {+ if (state === "archived" || state === "all") {+ return {+ query: "",+ scopes: [+ { id: "state", value: state === "archived" ? "DELETED" : "ALL" },+ ],+ };+ }+ return { query: "", scopes: [] };+};++export type URLSearchParamOptions<T> = {+ param: string;+ parse: (value: string) => T;+ serialize: (value: T) => string;+ defaultValue: T;+};++/**+ * Keeps state in the current URL instead of mirroring it through an effect.+ * React Router remains the source of truth, so browser Back/Forward updates+ * the value while the route component stays mounted.+ *+ * A value that serializes identically to `defaultValue` is elided from the+ * URL. Any other value is kept as an explicit param — for pages whose default+ * is not empty, `?q=` is how an empty/All selection survives a remount.+ */+export function useURLSearchParam(options: {+ param: string;+ defaultValue: string;+}): [string, Dispatch<SetStateAction<string>>];+export function useURLSearchParam<T>(+ options: URLSearchParamOptions<T>+): [T, Dispatch<SetStateAction<T>>];+export function useURLSearchParam<T>({+ param,+ parse = identity as unknown as (value: string) => T,+ serialize = identity as unknown as (value: T) => string,+ defaultValue,+}: Partial<URLSearchParamOptions<T>> & {+ param: string;+ defaultValue: T;+}): [T, Dispatch<SetStateAction<T>>] {+ const [urlSearchParams, setURLSearchParams] = useSearchParams();+ const hasParam = urlSearchParams.has(param);+ const rawValue = urlSearchParams.get(param) ?? "";++ // Deliberately independent of `defaultValue`: an async default (e.g. one+ // derived from the resolving current user) must not recompute — and change+ // the identity of — a value that came from the URL.+ const parsedValue = useMemo(+ () => (hasParam ? parse(rawValue) : undefined),+ [hasParam, parse, rawValue]+ );+ const value = hasParam ? (parsedValue as T) : defaultValue;++ const urlSearchParamsRef = useRef(urlSearchParams);+ urlSearchParamsRef.current = urlSearchParams;++ const setValue = useCallback<Dispatch<SetStateAction<T>>>(+ (action) => {+ const apply = (current: URLSearchParams): URLSearchParams => {+ const has = current.has(param);+ const raw = current.get(param) ?? "";+ const next =+ typeof action === "function"+ ? (action as (previous: T) => T)(has ? parse(raw) : defaultValue)+ : action;+ const nextRaw = serialize(next);+ if (nextRaw === serialize(defaultValue)) {+ if (!has) return current;+ const nextParams = new URLSearchParams(current);+ nextParams.delete(param);+ return nextParams;+ }+ if (has && raw === nextRaw) return current;+ const nextParams = new URLSearchParams(current);+ nextParams.set(param, nextRaw);+ return nextParams;+ };+ // Skip the replace navigation when the URL would not change.+ if (apply(urlSearchParamsRef.current) === urlSearchParamsRef.current) {+ return;+ }+ setURLSearchParams(apply, { replace: true });+ },+ [defaultValue, param, parse, serialize, setURLSearchParams]+ );++ return [value, setValue];+}diff --git a/frontend/src/react/pages/project/ProjectIssueDashboardPage.creators.test.ts b/frontend/src/react/pages/project/ProjectIssueDashboardPage.creators.test.tsindex 74cd7d992a..1b27b828dd 100644--- a/frontend/src/react/pages/project/ProjectIssueDashboardPage.creators.test.ts+++ b/frontend/src/react/pages/project/ProjectIssueDashboardPage.creators.test.ts@@ -11,4 +11,11 @@ describe("project issue list creator cache", () => {/batchGetOrFetchUsers\(paged\.dataList\.map\(\(issue\) => issue\.creator\)\)/);});++ test("keeps presets and rows in one bordered list surface", () => {+ expect(source.indexOf("<IssueListPanel")).toBeGreaterThan(+ source.indexOf("<ProjectPageContent>")+ );+ expect(source).toContain('<ProjectPageFooter className="px-2">');+ });});diff --git a/frontend/src/react/pages/project/ProjectIssueDashboardPage.tsx b/frontend/src/react/pages/project/ProjectIssueDashboardPage.tsxindex b50bce76aa..5face98cb3 100644--- a/frontend/src/react/pages/project/ProjectIssueDashboardPage.tsx+++ b/frontend/src/react/pages/project/ProjectIssueDashboardPage.tsx@@ -1,13 +1,11 @@-import { Loader2 } from "lucide-react";-import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import { useCallback, useEffect, useMemo, useState } from "react";import { useTranslation } from "react-i18next";import type { SearchParams } from "@/react/components/AdvancedSearch";import {BatchActionBar,BatchIssueStatusActionDrawer,- IssueListItem,+ IssueListPanel,IssueSearchBar,- PresetButtons,useIssueSearchScopeOptions,} from "@/react/components/IssueTable";import {@@ -18,8 +16,8 @@ import {} from "@/react/components/ProjectPageLayout";import { useCurrentUser } from "@/react/hooks/useAppState";import { PagedTableFooter, usePagedData } from "@/react/hooks/usePagedData";+import { useURLSearchParam } from "@/react/hooks/useURLSearchParam";import { refreshIssueList } from "@/react/lib/issue/issueListRefresh";-import { router } from "@/react/router";import { useAppStore } from "@/react/stores/app";import { projectNamePrefix } from "@/store/modules/v1/common";import { ApprovalStatus } from "@/types/proto-es/v1/common_pb";@@ -30,10 +28,15 @@ import {buildSearchParamsBySearchText,buildSearchTextBySearchParams,mergeSearchParams,- type SearchParams as VueSearchParams,type SearchScope as VueSearchScope,} from "@/utils";+const serializeSearchParams = (params: SearchParams): string =>+ buildSearchTextBySearchParams({+ ...params,+ scopes: params.scopes.filter((scope) => !scope.readonly),+ });+export function ProjectIssueDashboardPage({projectId,}: {@@ -53,16 +56,12 @@ export function ProjectIssueDashboardPage({[projectId]);- const defaultSearchParams = useCallback((): SearchParams => {+ const defaultSearchParams = useMemo((): SearchParams => {const myEmail = me?.email ?? "";return {query: "",scopes: [- ...readonlyScopes.map((s) => ({- id: s.id,- value: s.value,- readonly: s.readonly,- })),+ ...readonlyScopes,{ id: "status", value: IssueStatus[IssueStatus.OPEN] },{id: "approval",@@ -73,81 +72,34 @@ export function ProjectIssueDashboardPage({};}, [readonlyScopes, me]);- // Initialize from URL or defaults- const initialQueryRef = useRef<string | null>(null);- const [searchParams, setSearchParams] = useState<SearchParams>(() => {- const urlQ = new URLSearchParams(window.location.search).get("q") ?? null;- initialQueryRef.current = urlQ;- if (urlQ) {- const urlParams = buildSearchParamsBySearchText(urlQ);- const base: VueSearchParams = {- query: "",- scopes: readonlyScopes as VueSearchScope[],- };- const merged = mergeSearchParams(base, urlParams as VueSearchParams);- return {- query: merged.query,- scopes: merged.scopes.map((s) => ({- id: s.id,- value: s.value,- readonly: (s as VueSearchScope & { readonly?: boolean }).readonly,- })),- };- }- return defaultSearchParams();+ const parseSearchParams = useCallback(+ (query: string): SearchParams => {+ const urlParams = buildSearchParamsBySearchText(query);+ return mergeSearchParams(+ { query: "", scopes: [...readonlyScopes] },+ {+ ...urlParams,+ // The project is owned by the route path, not the query string.+ scopes: urlParams.scopes.filter((scope) => scope.id !== "project"),+ }+ );+ },+ [readonlyScopes]+ );+ const [searchParams, setSearchParams] = useURLSearchParam({+ param: "q",+ parse: parseSearchParams,+ serialize: serializeSearchParams,+ defaultValue: defaultSearchParams,+ });+ const [orderBy, setOrderBy] = useURLSearchParam({+ param: "order",+ defaultValue: "",});-- const [orderBy, setOrderBy] = useState("");-- // Reset on project change- useEffect(() => {- setSearchParams(defaultSearchParams());- }, [projectId]);-- // URL sync- const isUpdatingUrl = useRef(false);- useEffect(() => {- if (isUpdatingUrl.current) return;- const queryString = buildSearchTextBySearchParams(- searchParams as VueSearchParams- );- const currentQ = new URLSearchParams(window.location.search).get("q");- if (queryString === currentQ) return;-- const isDefault =- queryString ===- buildSearchTextBySearchParams(defaultSearchParams() as VueSearchParams);- if (isDefault && !initialQueryRef.current) {- if (currentQ) {- isUpdatingUrl.current = true;- router- .replace({- query: { ...router.currentRoute.value.query, q: undefined },- })- .finally(() => {- isUpdatingUrl.current = false;- });- }- } else {- isUpdatingUrl.current = true;- router- .replace({- query: {- ...router.currentRoute.value.query,- q: queryString || undefined,- },- })- .finally(() => {- isUpdatingUrl.current = false;- });- }- }, [searchParams]);// Issue filterconst issueFilter = useMemo(() => {- const filter = buildIssueFilterBySearchParams(- searchParams as VueSearchParams- );+ const filter = buildIssueFilterBySearchParams(searchParams);filter.orderBy = orderBy;return filter;}, [searchParams, orderBy]);@@ -242,31 +194,19 @@ export function ProjectIssueDashboardPage({onOrderByChange={setOrderBy}scopeOptions={scopeOptions}/>- <PresetButtons params={searchParams} onParamsChange={setSearchParams} /></div><ProjectPageContent>- {paged.isLoading ? (- <div className="flex justify-center py-8 text-control-light">- <Loader2 className="w-5 h-5 animate-spin" />- </div>- ) : paged.dataList.length === 0 ? (- <div className="flex justify-center py-8 text-control-light">- {t("common.no-data")}- </div>- ) : (- paged.dataList.map((issue) => (- <IssueListItem- key={issue.name}- issue={issue}- selected={selectedNames.has(issue.name)}- onToggleSelection={toggleSelection}- highlightText={searchParams.query}- />- ))- )}+ <IssueListPanel+ params={searchParams}+ onParamsChange={setSearchParams}+ isLoading={paged.isLoading}+ issues={paged.dataList}+ selectedNames={selectedNames}+ onToggleSelection={toggleSelection}+ />{paged.dataList.length > 0 && (- <ProjectPageFooter>+ <ProjectPageFooter className="px-2"><PagedTableFooterpageSize={paged.pageSize}pageSizeOptions={paged.pageSizeOptions}diff --git a/frontend/src/react/pages/project/ProjectPageLayout.test.ts b/frontend/src/react/pages/project/ProjectPageLayout.test.tsindex 77dbdaac98..9a7468e462 100644--- a/frontend/src/react/pages/project/ProjectPageLayout.test.ts+++ b/frontend/src/react/pages/project/ProjectPageLayout.test.ts@@ -53,6 +53,7 @@ describe("project page layout", () => {expect(source).toContain("paddingBlock: 16");expect(source).toContain("paddingInline: 16");expect(source).toContain("rowGap: 16");+ expect(source).toContain('<Alert role="note"');expect(source).toContain('overflowX: "clip"');expect(source).not.toContain('overflowX: "hidden"');expect(source).not.toContain("paddingBottom: 8");@@ -169,6 +170,11 @@ describe("project page layout", () => {test("uses bordered table surfaces inside padded project pages", () => {const projectPlanPage = readProjectPage("ProjectPlanDashboardPage.tsx");+ const projectIssuePage = readProjectPage("ProjectIssueDashboardPage.tsx");+ const issueTable = readFileSync(+ join(componentsDir, "IssueTable.tsx"),+ "utf8"+ );const auditLogTable = readFileSync(join(componentsDir, "AuditLogTable.tsx"),"utf8"@@ -177,6 +183,10 @@ describe("project page layout", () => {expect(projectPlanPage).toContain('className="overflow-x-auto rounded-sm border border-block-border"');+ expect(projectIssuePage).toContain("<IssueListPanel");+ expect(issueTable).toContain(+ 'className="overflow-hidden rounded-sm border border-block-border"'+ );expect(auditLogTable).toContain('className="overflow-x-auto rounded-sm border border-block-border"');diff --git a/frontend/src/react/pages/project/ProjectReleaseDashboardPage.tsx b/frontend/src/react/pages/project/ProjectReleaseDashboardPage.tsxindex ef9807e8de..00681d9e0e 100644--- a/frontend/src/react/pages/project/ProjectReleaseDashboardPage.tsx+++ b/frontend/src/react/pages/project/ProjectReleaseDashboardPage.tsx@@ -1,6 +1,6 @@import { create } from "@bufbuild/protobuf";import { Loader2 } from "lucide-react";-import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import { useCallback, useEffect, useMemo, useState } from "react";import { useTranslation } from "react-i18next";import { releaseServiceClientConnect } from "@/connect";import { HumanizeTs } from "@/react/components/HumanizeTs";@@ -21,6 +21,7 @@ import {TableRow,} from "@/react/components/ui/table";import { PagedTableFooter, usePagedData } from "@/react/hooks/usePagedData";+import { useURLSearchParam } from "@/react/hooks/useURLSearchParam";import { cn } from "@/react/lib/utils";import { router } from "@/react/router";import { useAppStore } from "@/react/stores/app";@@ -29,7 +30,7 @@ import { getTimeForPbTimestampProtoEs } from "@/types";import { State } from "@/types/proto-es/v1/common_pb";import type { Release } from "@/types/proto-es/v1/release_service_pb";import { ListReleaseCategoriesRequestSchema } from "@/types/proto-es/v1/release_service_pb";-import { buildCategoryFilter, buildCategoryQuery } from "@/utils/releaseFilter";+import { buildCategoryFilter } from "@/utils/releaseFilter";const MAX_SHOW_FILES_COUNT = 3;@@ -44,13 +45,11 @@ export function ProjectReleaseDashboardPage({);const projectName = `${projectNamePrefix}${projectId}`;- // Category filter from URL- const [selectedCategory, setSelectedCategory] = useState<string | undefined>(- () => {- const params = new URLSearchParams(window.location.search);- return params.get("category") || undefined;- }- );+ // Empty string means "All" — elided from the URL as the default.+ const [selectedCategory, setSelectedCategory] = useURLSearchParam({+ param: "category",+ defaultValue: "",+ });// Fetch categoriesconst [categories, setCategories] = useState<string[]>([]);@@ -68,17 +67,6 @@ export function ProjectReleaseDashboardPage({.finally(() => setCategoriesLoading(false));}, [projectName]);- // URL sync- const isUpdatingUrl = useRef(false);- useEffect(() => {- if (isUpdatingUrl.current) return;- isUpdatingUrl.current = true;- const query = buildCategoryQuery(selectedCategory);- router.replace({ query }).finally(() => {- isUpdatingUrl.current = false;- });- }, [selectedCategory]);-// Fetch releasesconst fetchReleaseList = useCallback(async (params: { pageSize: number; pageToken: string }) => {@@ -126,7 +114,7 @@ export function ProjectReleaseDashboardPage({<Buttonappearance="secondary"size="sm"- onClick={() => setSelectedCategory(undefined)}+ onClick={() => setSelectedCategory("")}>{t("common.clear-filters")}</Button>@@ -175,16 +163,16 @@ function CategorySelect({categories,loading,}: {- value: string | undefined;- onChange: (value: string | undefined) => void;+ value: string;+ onChange: (value: string) => void;categories: string[];loading: boolean;}) {return (<selectclassName="w-64 border border-control-border rounded-sm text-sm px-3 py-1.5 bg-background focus:outline-none focus:border-accent"- value={value ?? ""}- onChange={(e) => onChange(e.target.value || undefined)}+ value={value}+ onChange={(e) => onChange(e.target.value)}disabled={loading}><option value="">All</option>diff --git a/frontend/src/react/pages/settings/DatabasesPage.test.tsx b/frontend/src/react/pages/settings/DatabasesPage.test.tsxindex 4c78f4d4f3..7658f33afc 100644--- a/frontend/src/react/pages/settings/DatabasesPage.test.tsx+++ b/frontend/src/react/pages/settings/DatabasesPage.test.tsx@@ -1,5 +1,6 @@import { act } from "react";import { createRoot } from "react-dom/client";+import { MemoryRouter } from "react-router-dom";import { beforeEach, describe, expect, test, vi } from "vitest";(@@ -131,7 +132,13 @@ describe("DatabasesPage", () => {const root = createRoot(container);await act(async () => {- root.render(<DatabasesPage />);+ // The page keeps its search state in the URL via useSearchParams, so it+ // needs a router context.+ root.render(+ <MemoryRouter>+ <DatabasesPage />+ </MemoryRouter>+ );await Promise.resolve();});diff --git a/frontend/src/react/pages/settings/DatabasesPage.tsx b/frontend/src/react/pages/settings/DatabasesPage.tsxindex 88676903a1..8781794fdd 100644--- a/frontend/src/react/pages/settings/DatabasesPage.tsx+++ b/frontend/src/react/pages/settings/DatabasesPage.tsx@@ -26,6 +26,11 @@ import {WorkspacePageLayout,WorkspacePageToolbar,} from "@/react/components/WorkspacePageLayout";+import {+ createAdvancedSearchParser,+ serializeAdvancedSearch,+ useURLSearchParam,+} from "@/react/hooks/useURLSearchParam";import type { DatabaseFilter } from "@/react/lib/databaseFilter";import { router } from "@/react/router";import { INSTANCE_ROUTE_CREATE } from "@/react/router/handles";@@ -57,6 +62,14 @@ import {supportedEngineV1List,} from "@/utils";+const parseDatabaseSearch = createAdvancedSearchParser([+ "project",+ "environment",+ "instance",+ "engine",+ "label",+]);+export function DatabasesPage() {const { t } = useTranslation();const databasesByName = useAppStore((s) => s.databasesByName);@@ -72,49 +85,6 @@ export function DatabasesPage() {const [showTransferDrawer, setShowTransferDrawer] = useState(false);const [refreshToken, setRefreshToken] = useState(0);- // Search state — default to showing unassigned databases from default project- const [searchParams, setSearchParams] = useState<SearchParams>(() => {- const currentRoute = router.currentRoute.value;- const hasQ = "q" in (currentRoute.query ?? {});- const queryString = (currentRoute.query.q as string) ?? "";- if (hasQ) {- // URL has an explicit `q` param (may be empty if the user cleared all- // filters) — parse it and do NOT re-apply the default project scope.- const scopes: { id: string; value: string }[] = [];- const queryParts: string[] = [];- for (const token of queryString.split(/\s+/).filter(Boolean)) {- const colonIdx = token.indexOf(":");- if (colonIdx > 0) {- const id = token.substring(0, colonIdx);- const value = token.substring(colonIdx + 1);- if (- value &&- ["project", "environment", "instance", "engine", "label"].includes(- id- )- ) {- scopes.push({ id, value });- continue;- }- }- queryParts.push(token);- }- return { query: queryParts.join(" "), scopes };- }- // First visit (no `q` in URL) — default to the unassigned project.- return {- query: "",- scopes: [- {- id: "project",- value: extractProjectResourceName(- useAppStore.getState().serverInfo?.defaultProject ?? ""- ),- },- ],- };- });-const environments = useAppStore((s) => s.environmentList);// `serverInfo.defaultProject` is fetched asynchronously by the actuator@@ -124,6 +94,21 @@ export function DatabasesPage() {const defaultProjectId = useAppStore((s) =>extractProjectResourceName(s.serverInfo?.defaultProject ?? ""));+ const defaultSearchParams = useMemo<SearchParams>(+ () => ({+ query: "",+ scopes: defaultProjectId+ ? [{ id: "project", value: defaultProjectId }]+ : [],+ }),+ [defaultProjectId]+ );+ const [searchParams, setSearchParams] = useURLSearchParam<SearchParams>({+ param: "q",+ parse: parseDatabaseSearch,+ serialize: serializeAdvancedSearch,+ defaultValue: defaultSearchParams,+ });// Shared "Unassigned" option used both by the dropdown (via onSearch) and// by the selected-tag display (via the scope's static `options`). `custom`// hides the raw "default-<random>" id from the dropdown so users only see@@ -306,40 +291,6 @@ export function DatabasesPage() {}}, []);- // Backfill the project scope once the actuator's default project ID- // arrives. The initial `useState` initializer reads the actuator- // synchronously — if it hasn't finished fetching yet, the project value- // is captured as "" and the API filter becomes broken (`projects/`).- useEffect(() => {- if (!defaultProjectId) return;- setSearchParams((prev) => {- const projectScope = prev.scopes.find((s) => s.id === "project");- if (!projectScope || projectScope.value !== "") return prev;- return {- ...prev,- scopes: prev.scopes.map((s) =>- s.id === "project" && s.value === ""- ? { ...s, value: defaultProjectId }- : s- ),- };- });- }, [defaultProjectId]);-- // Sync search state to URL- useEffect(() => {- const parts: string[] = [];- for (const scope of searchParams.scopes) {- parts.push(`${scope.id}:${scope.value}`);- }- if (searchParams.query) parts.push(searchParams.query);- const queryString = parts.join(" ");- const currentQuery = router.currentRoute.value.query.q as string;- if (queryString !== (currentQuery ?? "")) {- router.replace({ query: { q: queryString } });- }- }, [searchParams]);-// Selection stateconst [selectedNames, setSelectedNames] = useState<Set<string>>(new Set());const [visibleDatabases, setVisibleDatabases] = useState<Database[]>([]);diff --git a/frontend/src/react/pages/settings/InstanceDetailPage.tsx b/frontend/src/react/pages/settings/InstanceDetailPage.tsxindex 6c2be5bda3..2d0e592bfd 100644--- a/frontend/src/react/pages/settings/InstanceDetailPage.tsx+++ b/frontend/src/react/pages/settings/InstanceDetailPage.tsx@@ -2,6 +2,7 @@ import { create } from "@bufbuild/protobuf";import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { useTranslation } from "react-i18next";+import { useLocation, useNavigate } from "react-router-dom";import {AdvancedSearch,getValueFromScopes,@@ -70,6 +71,8 @@ const isInstanceHash = (x: unknown): x is InstanceHash =>export function InstanceDetailPage({ instanceId }: { instanceId: string }) {const { t } = useTranslation();+ const location = useLocation();+ const navigate = useNavigate();const databasesByName = useAppStore((s) => s.databasesByName);const getDatabaseByName = useAppStore((s) => s.getDatabaseByName);const removeDatabaseMetadataCache = useAppStore(@@ -82,7 +85,10 @@ export function InstanceDetailPage({ instanceId }: { instanceId: string }) {[cachedInstance, instanceName]);- const [selectedTab, setSelectedTab] = useState<InstanceHash>("overview");+ const routeHash = location.hash.replace(/^#?/, "");+ const selectedTab: InstanceHash = isInstanceHash(routeHash)+ ? routeHash+ : "overview";const [searchParams, setSearchParams] = useState<SearchParams>({query: "",scopes: [{ id: "instance", value: instanceId, readonly: true }],@@ -257,20 +263,30 @@ export function InstanceDetailPage({ instanceId }: { instanceId: string }) {void useAppStore.getState().getOrFetchInstanceByName(instanceName);}, [instanceName]);- // Sync tab with URL hash+ // Canonicalize legacy query state and invalid/missing hashes. The location+ // remains the tab source of truth, so Back/Forward updates the selected tab.useEffect(() => {- const hash = window.location.hash.replace(/^#?/, "");- if (isInstanceHash(hash)) {- setSelectedTab(hash);- }- }, []);-- useEffect(() => {- const query = new URLSearchParams(window.location.search);+ const query = new URLSearchParams(location.search);query.delete("qs");- const url = `${window.location.pathname}?${query.toString()}#${selectedTab}`;- window.history.replaceState(null, "", url);- }, [selectedTab]);+ const search = query.toString();+ const nextSearch = search ? `?${search}` : "";+ const nextHash = `#${selectedTab}`;+ if (location.search === nextSearch && location.hash === nextHash) return;+ void navigate(+ {+ pathname: location.pathname,+ search: nextSearch,+ hash: nextHash,+ },+ { replace: true }+ );+ }, [+ location.hash,+ location.pathname,+ location.search,+ navigate,+ selectedTab,+ ]);// Set document titleuseEffect(() => {@@ -388,11 +404,20 @@ export function InstanceDetailPage({ instanceId }: { instanceId: string }) {[t, environments, searchProjects, unassignedProjectOption]);- const handleTabChange = useCallback((tab: string | number | null) => {- if (typeof tab === "string" && isInstanceHash(tab)) {- setSelectedTab(tab);- }- }, []);+ const handleTabChange = useCallback(+ (tab: string | number | null) => {+ if (typeof tab !== "string" || !isInstanceHash(tab)) return;+ void navigate(+ {+ pathname: location.pathname,+ search: location.search,+ hash: `#${tab}`,+ },+ { replace: true }+ );+ },+ [location.pathname, location.search, navigate]+ );return (<div className="p-4 flex flex-col gap-y-2">@@ -482,8 +507,7 @@ export function InstanceDetailPage({ instanceId }: { instanceId: string }) {onDatabasesChange={setVisibleDatabases}refreshToken={refreshToken}/>- {/* Batch operations bar (sticky at bottom; rendered after the- table so selection doesn't shift table position) */}+ {/* Batch operations bar is fixed within the visible main content. */}<DatabaseBatchOperationsBardatabases={selectedDatabases}onSyncSchema={handleSyncSchema}diff --git a/frontend/src/react/pages/settings/InstancesPage.tsx b/frontend/src/react/pages/settings/InstancesPage.tsxindex b39e87df36..54008d9ee9 100644--- a/frontend/src/react/pages/settings/InstancesPage.tsx+++ b/frontend/src/react/pages/settings/InstancesPage.tsx@@ -70,8 +70,14 @@ import {getPageSizeOptions,useSessionPageSize,} from "@/react/hooks/useSessionPageSize";+import {+ createAdvancedSearchParser,+ legacyStateSearchParams,+ serializeAdvancedSearch,+ useURLSearchParam,+} from "@/react/hooks/useURLSearchParam";import { cn } from "@/react/lib/utils";-import { router } from "@/react/router";+import { router, useCurrentRoute } from "@/react/router";import { INSTANCE_ROUTE_CREATE } from "@/react/router/handles";import { useAppStore } from "@/react/stores/app";import type { InstanceFilter } from "@/react/stores/app/types";@@ -99,6 +105,14 @@ import {const ASSIGN_LICENSE_QUERY = "assignLicense";const ASSIGN_LICENSE_INSTANCES_QUERY = "instances";+const parseInstanceSearch = createAdvancedSearchParser([+ "environment",+ "engine",+ "label",+ "state",+ "host",+ "port",+]);interface InstanceColumn {key: string;@@ -518,44 +532,17 @@ function EditEnvironmentSheet({export function InstancesPage() {const { t } = useTranslation();+ const route = useCurrentRoute();- // Search state- const [searchParams, setSearchParams] = useState<SearchParams>(() => {- const currentRoute = router.currentRoute.value;- const queryState = currentRoute.query.state as string;- if (queryState === "archived" || queryState === "all") {- const stateValue = queryState === "archived" ? "DELETED" : "ALL";- return { query: "", scopes: [{ id: "state", value: stateValue }] };- }- const queryString = currentRoute.query.q as string;- if (queryString) {- const scopes: { id: string; value: string }[] = [];- const queryParts: string[] = [];- for (const token of queryString.split(/\s+/).filter(Boolean)) {- const colonIdx = token.indexOf(":");- if (colonIdx > 0) {- const id = token.substring(0, colonIdx);- const value = token.substring(colonIdx + 1);- if (- value &&- [- "environment",- "engine",- "label",- "state",- "host",- "port",- ].includes(id)- ) {- scopes.push({ id, value });- continue;- }- }- queryParts.push(token);- }- return { query: queryParts.join(" "), scopes };- }- return { query: "", scopes: [] };+ const defaultSearchParams = useMemo<SearchParams>(+ () => legacyStateSearchParams(route.query.state),+ [route.query.state]+ );+ const [searchParams, setSearchParams] = useURLSearchParam<SearchParams>({+ param: "q",+ parse: parseInstanceSearch,+ serialize: serializeAdvancedSearch,+ defaultValue: defaultSearchParams,});// Scope options@@ -675,22 +662,6 @@ export function InstancesPage() {}}, []);- // Sync search state to URL- useEffect(() => {- const parts: string[] = [];- for (const scope of searchParams.scopes) {- parts.push(`${scope.id}:${scope.value}`);- }- if (searchParams.query) parts.push(searchParams.query);- const queryString = parts.join(" ");- const currentQuery = router.currentRoute.value.query;- const currentQueryString = currentQuery.q as string;- if (queryString !== (currentQueryString ?? "")) {- const nextQuery = { ...currentQuery, q: queryString };- router.replace({ query: nextQuery });- }- }, [searchParams]);-// Instance count warningconst instanceCountLimit = useAppStore((s) => s.instanceCountLimit());const totalInstanceCount = useAppStore((s) => s.totalInstanceCount());@@ -907,28 +878,26 @@ export function InstancesPage() {[hasSplitInstanceLicense]);+ // Depend on the two primitive params, not `route.query` — the route object+ // is rebuilt every render, which would re-run this effect each time.+ const assignLicenseFlag = route.query[ASSIGN_LICENSE_QUERY];+ const rawAssignLicenseInstances = route.query[ASSIGN_LICENSE_INSTANCES_QUERY];useEffect(() => {- const query = router.currentRoute.value.query;- if (query[ASSIGN_LICENSE_QUERY] !== "1") {+ if (assignLicenseFlag !== "1") {return;}- const rawInstances = query[ASSIGN_LICENSE_INSTANCES_QUERY];const names =- typeof rawInstances === "string"- ? rawInstances.split(",").filter(Boolean)- : Array.isArray(rawInstances)- ? rawInstances.filter(- (name): name is string => typeof name === "string"- )- : [];+ typeof rawAssignLicenseInstances === "string"+ ? rawAssignLicenseInstances.split(",").filter(Boolean)+ : [];handleAssignLicense(names);- const nextQuery = { ...query };+ const nextQuery = { ...router.currentRoute.value.query };delete nextQuery[ASSIGN_LICENSE_QUERY];delete nextQuery[ASSIGN_LICENSE_INSTANCES_QUERY];router.replace({ query: nextQuery });- }, [handleAssignLicense]);+ }, [assignLicenseFlag, rawAssignLicenseInstances, handleAssignLicense]);// Data source toggleconst [expandedDataSources, setExpandedDataSources] = useState<Set<string>>(@@ -1224,8 +1193,7 @@ export function InstancesPage() {/></WorkspacePageFooter>- {/* Batch operations bar (sticky at bottom; rendered after the- table so selection doesn't shift table position) */}+ {/* Batch operations bar is fixed within the visible main content. */}{(() => {const canSync = hasWorkspacePermissionV2("bb.instances.sync");const canUpdate = hasWorkspacePermissionV2("bb.instances.update");diff --git a/frontend/src/react/pages/settings/ProjectsPage.tsx b/frontend/src/react/pages/settings/ProjectsPage.tsxindex 235262fa48..93d471eb02 100644--- a/frontend/src/react/pages/settings/ProjectsPage.tsx+++ b/frontend/src/react/pages/settings/ProjectsPage.tsx@@ -38,8 +38,14 @@ import {getPageSizeOptions,useSessionPageSize,} from "@/react/hooks/useSessionPageSize";+import {+ createAdvancedSearchParser,+ legacyStateSearchParams,+ serializeAdvancedSearch,+ useURLSearchParam,+} from "@/react/hooks/useURLSearchParam";import { cn } from "@/react/lib/utils";-import { router } from "@/react/router";+import { router, useCurrentRoute } from "@/react/router";import { PROJECT_V1_ROUTE_ISSUES } from "@/react/router/handles";import { useAppStore } from "@/react/stores/app";import { pushNotification } from "@/store";@@ -52,6 +58,8 @@ import {hasWorkspacePermissionV2,} from "@/utils";+const parseProjectSearch = createAdvancedSearchParser(["state", "label"]);+export function projectIssuesRoute(project: Project) {return {name: PROJECT_V1_ROUTE_ISSUES,@@ -232,35 +240,17 @@ function ProjectActionDropdown({export function ProjectsPage() {const { t } = useTranslation();const isLoggedIn = useAppStore((s) => s.isLoggedIn());+ const route = useCurrentRoute();- // Search state — managed as SearchParams (query + scopes)- const [searchParams, setSearchParams] = useState<SearchParams>(() => {- const currentRoute = router.currentRoute.value;- // Migrate old URL format- const queryState = currentRoute.query.state as string;- if (queryState === "archived" || queryState === "all") {- const stateValue = queryState === "archived" ? "DELETED" : "ALL";- return { query: "", scopes: [{ id: "state", value: stateValue }] };- }- const queryString = currentRoute.query.q as string;- if (queryString) {- const scopes: { id: string; value: string }[] = [];- const queryParts: string[] = [];- for (const token of queryString.split(/\s+/).filter(Boolean)) {- const colonIdx = token.indexOf(":");- if (colonIdx > 0) {- const id = token.substring(0, colonIdx);- const value = token.substring(colonIdx + 1);- if (value && (id === "state" || id === "label")) {- scopes.push({ id, value });- continue;- }- }- queryParts.push(token);- }- return { query: queryParts.join(" "), scopes };- }- return { query: "", scopes: [] };+ const defaultSearchParams = useMemo<SearchParams>(+ () => legacyStateSearchParams(route.query.state),+ [route.query.state]+ );+ const [searchParams, setSearchParams] = useURLSearchParam<SearchParams>({+ param: "q",+ parse: parseProjectSearch,+ serialize: serializeAdvancedSearch,+ defaultValue: defaultSearchParams,});// Scope options for the AdvancedSearch@@ -314,20 +304,6 @@ export function ProjectsPage() {}}, []);- // Sync search state to URL- useEffect(() => {- const parts: string[] = [];- for (const scope of searchParams.scopes) {- parts.push(`${scope.id}:${scope.value}`);- }- if (searchParams.query) parts.push(searchParams.query);- const queryString = parts.join(" ");- const currentQuery = router.currentRoute.value.query.q as string;- if (queryString !== (currentQuery ?? "")) {- router.replace({ query: { q: queryString } });- }- }, [searchParams]);-// Data fetching stateconst [projects, setProjects] = useState<Project[]>([]);const [loading, setLoading] = useState(true);@@ -669,8 +645,7 @@ export function ProjectsPage() {/></WorkspacePageFooter>- {/* Batch operations bar (sticky at bottom; rendered after the- table so selection doesn't shift table position) */}+ {/* Batch operations bar is fixed within the visible main content. */}{canDelete && (<SelectionActionBarcount={selectedProjectList.length}diff --git a/frontend/src/react/pages/settings/WorkspacePageLayout.test.ts b/frontend/src/react/pages/settings/WorkspacePageLayout.test.tsindex 2d191619be..35dd550eac 100644--- a/frontend/src/react/pages/settings/WorkspacePageLayout.test.ts+++ b/frontend/src/react/pages/settings/WorkspacePageLayout.test.ts@@ -74,6 +74,7 @@ describe("workspace list page layout", () => {expect(source).toContain('padding = "page"');expect(source).toContain("pagePadding");expect(source).toContain("paddingInline: 16");+ expect(source).toContain('<Alert role="note"');expect(source).not.toContain("paddingBottom: 8");});diff --git a/frontend/src/react/pages/workspace/MyIssuesPage.creators.test.ts b/frontend/src/react/pages/workspace/MyIssuesPage.creators.test.tsindex 4e07a96095..290bc0e508 100644--- a/frontend/src/react/pages/workspace/MyIssuesPage.creators.test.ts+++ b/frontend/src/react/pages/workspace/MyIssuesPage.creators.test.ts@@ -11,4 +11,11 @@ describe("my issue list creator cache", () => {/batchGetOrFetchUsers\(paged\.dataList\.map\(\(issue\) => issue\.creator\)\)/);});++ test("shares the workspace layout and bordered issue-list surface", () => {+ expect(source).toContain("WorkspacePageLayout");+ expect(source).toContain("WorkspacePageContent");+ expect(source).toContain("<IssueListPanel");+ expect(source).toContain('<WorkspacePageFooter className="px-2">');+ });});diff --git a/frontend/src/react/pages/workspace/MyIssuesPage.tsx b/frontend/src/react/pages/workspace/MyIssuesPage.tsxindex af1e8483ea..19bcbe8e16 100644--- a/frontend/src/react/pages/workspace/MyIssuesPage.tsx+++ b/frontend/src/react/pages/workspace/MyIssuesPage.tsx@@ -1,19 +1,21 @@-import { Loader2 } from "lucide-react";-import { useCallback, useEffect, useMemo, useRef, useState } from "react";-import { useTranslation } from "react-i18next";+import { useCallback, useEffect, useMemo, useState } from "react";import type { SearchParams } from "@/react/components/AdvancedSearch";import {BatchActionBar,BatchIssueStatusActionDrawer,- IssueListItem,+ IssueListPanel,IssueSearchBar,- PresetButtons,useIssueSearchScopeOptions,} from "@/react/components/IssueTable";+import {+ WorkspacePageContent,+ WorkspacePageFooter,+ WorkspacePageLayout,+} from "@/react/components/WorkspacePageLayout";import { useCurrentUser } from "@/react/hooks/useAppState";import { PagedTableFooter, usePagedData } from "@/react/hooks/usePagedData";+import { useURLSearchParam } from "@/react/hooks/useURLSearchParam";import { refreshIssueList } from "@/react/lib/issue/issueListRefresh";-import { router } from "@/react/router";import { useAppStore } from "@/react/stores/app";import { ApprovalStatus } from "@/types/proto-es/v1/common_pb";import type { Issue } from "@/types/proto-es/v1/issue_service_pb";@@ -22,17 +24,20 @@ import {buildIssueFilterBySearchParams,buildSearchParamsBySearchText,buildSearchTextBySearchParams,- type SearchParams as VueSearchParams,} from "@/utils";+const parseSearchParams = (query: string): SearchParams =>+ buildSearchParamsBySearchText(query);+const serializeSearchParams = (params: SearchParams): string =>+ buildSearchTextBySearchParams(params);+export function MyIssuesPage() {- const { t } = useTranslation();const batchGetOrFetchUsers = useAppStore((state) => state.batchGetOrFetchUsers);const me = useCurrentUser();- const defaultSearchParams = useCallback((): SearchParams => {+ const defaultSearchParams = useMemo((): SearchParams => {const myEmail = me?.email ?? "";return {query: "",@@ -47,63 +52,20 @@ export function MyIssuesPage() {};}, [me]);- // Initialize from URL or defaults- const initialQueryRef = useRef<string | null>(null);- const [searchParams, setSearchParams] = useState<SearchParams>(() => {- const urlQ = new URLSearchParams(window.location.search).get("q") ?? null;- initialQueryRef.current = urlQ;- if (urlQ) {- return buildSearchParamsBySearchText(urlQ) as SearchParams;- }- return defaultSearchParams();+ const [searchParams, setSearchParams] = useURLSearchParam({+ param: "q",+ parse: parseSearchParams,+ serialize: serializeSearchParams,+ defaultValue: defaultSearchParams,+ });+ const [orderBy, setOrderBy] = useURLSearchParam({+ param: "order",+ defaultValue: "",});-- const [orderBy, setOrderBy] = useState("");-- // URL sync- const isUpdatingUrl = useRef(false);- useEffect(() => {- if (isUpdatingUrl.current) return;- const queryString = buildSearchTextBySearchParams(- searchParams as VueSearchParams- );- const currentQ = new URLSearchParams(window.location.search).get("q");- if (queryString === currentQ) return;-- const isDefault =- queryString ===- buildSearchTextBySearchParams(defaultSearchParams() as VueSearchParams);- if (isDefault && !initialQueryRef.current) {- if (currentQ) {- isUpdatingUrl.current = true;- router- .replace({- query: { ...router.currentRoute.value.query, q: undefined },- })- .finally(() => {- isUpdatingUrl.current = false;- });- }- } else {- isUpdatingUrl.current = true;- router- .replace({- query: {- ...router.currentRoute.value.query,- q: queryString || undefined,- },- })- .finally(() => {- isUpdatingUrl.current = false;- });- }- }, [searchParams]);// Issue filterconst issueFilter = useMemo(() => {- const filter = buildIssueFilterBySearchParams(- searchParams as VueSearchParams- );+ const filter = buildIssueFilterBySearchParams(searchParams);filter.orderBy = orderBy;return filter;}, [searchParams, orderBy]);@@ -188,41 +150,27 @@ export function MyIssuesPage() {}, [paged]);return (- <div className="py-4 flex flex-col">- <div className="px-4 flex flex-col gap-y-2">- <IssueSearchBar+ <WorkspacePageLayout>+ <IssueSearchBar+ params={searchParams}+ onParamsChange={setSearchParams}+ orderBy={orderBy}+ onOrderByChange={setOrderBy}+ scopeOptions={scopeOptions}+ />++ <WorkspacePageContent>+ <IssueListPanelparams={searchParams}onParamsChange={setSearchParams}- orderBy={orderBy}- onOrderByChange={setOrderBy}- scopeOptions={scopeOptions}+ isLoading={paged.isLoading}+ issues={paged.dataList}+ selectedNames={selectedNames}+ onToggleSelection={toggleSelection}+ showProject/>- <PresetButtons params={searchParams} onParamsChange={setSearchParams} />- </div>-- <div className="mt-2">- {paged.isLoading ? (- <div className="flex justify-center py-8 text-control-light">- <Loader2 className="w-5 h-5 animate-spin" />- </div>- ) : paged.dataList.length === 0 ? (- <div className="flex justify-center py-8 text-control-light">- {t("common.no-data")}- </div>- ) : (- paged.dataList.map((issue) => (- <IssueListItem- key={issue.name}- issue={issue}- selected={selectedNames.has(issue.name)}- onToggleSelection={toggleSelection}- highlightText={searchParams.query}- showProject- />- ))- )}{paged.dataList.length > 0 && (- <div className="mt-4 mx-2">+ <WorkspacePageFooter className="px-2"><PagedTableFooterpageSize={paged.pageSize}pageSizeOptions={paged.pageSizeOptions}@@ -231,9 +179,9 @@ export function MyIssuesPage() {isFetchingMore={paged.isFetchingMore}onLoadMore={paged.loadMore}/>- </div>+ </WorkspacePageFooter>)}- </div>+ </WorkspacePageContent>{selectedIssues.length > 0 && (<BatchActionBar@@ -254,6 +202,6 @@ export function MyIssuesPage() {onClose={() => setBatchAction(undefined)}onUpdated={handleBatchUpdated}/>- </div>+ </WorkspacePageLayout>);}diff --git a/frontend/src/utils/releaseFilter.ts b/frontend/src/utils/releaseFilter.tsindex 360e164cbc..3c4d57cc47 100644--- a/frontend/src/utils/releaseFilter.ts+++ b/frontend/src/utils/releaseFilter.ts@@ -3,20 +3,3 @@ export const buildCategoryFilter = (category: string | undefined): string => {if (!category) return "";return `category == "${category}"`;};--// Parse category from URL query params-export const parseCategoryFromUrl = (- query: Record<string, unknown>-): string | undefined => {- const category = query.category;- if (!category || typeof category !== "string") return undefined;- return category;-};--// Build URL query params from category-export const buildCategoryQuery = (- category: string | undefined-): Record<string, string> => {- if (!category) return {};- return { category };-};