Sync session URL when opening chats

This commit is contained in:
wuyang6
2026-05-14 16:02:27 +08:00
parent 997f5cd60b
commit e48c0ff981
4 changed files with 22 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
"use client";
export function pushSessionUrl(sessionId: string) {
if (typeof window === "undefined") return;
const target = `/session/${encodeURIComponent(sessionId)}`;
if (window.location.pathname === target) return;
window.history.pushState(null, "", target);
}
export function pushHomeUrl() {
if (typeof window === "undefined") return;
if (window.location.pathname === "/") return;
window.history.pushState(null, "", "/");
}