Files
cobble/src/functions/frontend/announce-shown-session.ts
T
tbenandClaude Opus 5.5 657a76d868 Mark the session on screen as Current in the session lists
- The conversation page tells the rail and the sessions modal which
  session it shows (announceShownSession, useShownSession); they reload,
  so a session reopened by ?session_id= shows at once.
- Only that session is Current and greyed out (the active one without
  ?session_id=); the active row then leads back to it.
- The rail lists the session on screen even when it's older than its
  latest sessions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 05:56:13 +01:00

19 lines
574 B
TypeScript

import type { ShownSession } from "@/src/types";
export const ShownSessionEvent = "cobble:session-shown";
/**
* The last session a conversation page showed, for a rail list that
* mounts after the page told it.
*/
export let lastShownSession: ShownSession | null = null;
/**
* Tells the rail which session the conversation page shows, once its
* history loads (`useShownSession`).
*/
export default function announceShownSession(shown: ShownSession) {
lastShownSession = shown;
window.dispatchEvent(new CustomEvent(ShownSessionEvent, { detail: shown }));
}