Sync session URL when opening chats
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
||||
readActiveSessionId,
|
||||
writeActiveSessionId,
|
||||
} from "@/lib/claw-active-session";
|
||||
import { pushHomeUrl, pushSessionUrl } from "@/lib/claw-session-url";
|
||||
import { useClawSessionReplay } from "@/lib/claw-session-replay";
|
||||
|
||||
type ClawSession = {
|
||||
@@ -121,6 +122,7 @@ const ThreadListNew: FC = () => {
|
||||
<div
|
||||
onClickCapture={() => {
|
||||
clearActiveSessionId();
|
||||
pushHomeUrl();
|
||||
window.dispatchEvent(new Event("claw-active-session-cleared"));
|
||||
}}
|
||||
>
|
||||
@@ -262,6 +264,7 @@ const ClawSessionList: FC = () => {
|
||||
onClick={async () => {
|
||||
setOpenMenuSessionId(null);
|
||||
writeActiveSessionId(session.session_id);
|
||||
pushSessionUrl(session.session_id);
|
||||
setActiveSessionId(session.session_id);
|
||||
setLoadingSessionId(session.session_id);
|
||||
try {
|
||||
|
||||
@@ -51,6 +51,7 @@ import {
|
||||
writeActiveSessionId,
|
||||
} from "@/lib/claw-active-session";
|
||||
import { useClawSessionReplay } from "@/lib/claw-session-replay";
|
||||
import { pushHomeUrl, pushSessionUrl } from "@/lib/claw-session-url";
|
||||
|
||||
type ThreadListSidebarProps = React.ComponentProps<typeof Sidebar> & {
|
||||
account: ClawAccount;
|
||||
@@ -201,6 +202,7 @@ function CollapsedSidebarRail({
|
||||
<div
|
||||
onClickCapture={() => {
|
||||
clearActiveSessionId();
|
||||
pushHomeUrl();
|
||||
window.dispatchEvent(new Event("claw-active-session-cleared"));
|
||||
}}
|
||||
>
|
||||
@@ -404,6 +406,7 @@ function useSidebarSessions(open: boolean) {
|
||||
const cleanSessionId = normalizeSessionId(sessionId);
|
||||
if (!cleanSessionId) return;
|
||||
writeActiveSessionId(cleanSessionId);
|
||||
pushSessionUrl(cleanSessionId);
|
||||
setLoadingSessionId(sessionId);
|
||||
try {
|
||||
const response = await fetch(`/api/claw/sessions/${cleanSessionId}`, {
|
||||
|
||||
Reference in New Issue
Block a user