From b4e8dc37697f1011792a0931e70cc34f7f3ac787 Mon Sep 17 00:00:00 2001 From: Naiyuan Qing <145280634+NevilleQingNY@users.noreply.github.com> Date: Mon, 30 Mar 2026 17:25:17 +0800 Subject: [PATCH] fix(inbox): use history.replaceState for selection to fix post-refresh clicks router.replace() triggers a full server navigation cycle in Next.js 15+, which can stall after a page refresh (no client route cache), preventing useSearchParams from updating and making inbox items unclickable. window.history.replaceState() updates the URL synchronously without triggering server navigation, which is the recommended approach for URL state management in Next.js 14.1+. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/web/app/(dashboard)/inbox/page.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/apps/web/app/(dashboard)/inbox/page.tsx b/apps/web/app/(dashboard)/inbox/page.tsx index 636dc795..e00ba229 100644 --- a/apps/web/app/(dashboard)/inbox/page.tsx +++ b/apps/web/app/(dashboard)/inbox/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { useSearchParams, useRouter } from "next/navigation"; +import { useSearchParams } from "next/navigation"; import { useDefaultLayout } from "react-resizable-panels"; import { useInboxStore } from "@/features/inbox"; import { IssueDetail, StatusIcon, PriorityIcon } from "@/features/issues/components"; @@ -191,14 +191,10 @@ function InboxListItem({ export default function InboxPage() { const searchParams = useSearchParams(); - const router = useRouter(); const selectedId = searchParams.get("id") ?? ""; const setSelectedId = (id: string) => { - if (id) { - router.replace(`/inbox?id=${id}`, { scroll: false }); - } else { - router.replace("/inbox", { scroll: false }); - } + const url = id ? `/inbox?id=${id}` : "/inbox"; + window.history.replaceState(null, "", url); }; const items = useInboxStore((s) => s.dedupedItems());