Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

planSidebarDismissal.ts

21 lines819 Bytes

1/**
2 * Tracks which turn's plan sidebar the user explicitly dismissed, per thread.
3 *
4 * Kept outside React state so a dismissal survives leaving and re-entering a
5 * thread (ChatView resets its per-thread refs on navigation). Dismissals are
6 * keyed by turn, so when a new turn produces fresh plan steps the sidebar
7 * still auto-opens.
8 */
9const dismissedTurnByThreadKey = new Map<string, string>();
10​
11export function dismissPlanSidebarForTurn(threadKey: string, turnKey: string): void {
12 dismissedTurnByThreadKey.set(threadKey, turnKey);
14​
15export function clearPlanSidebarDismissal(threadKey: string): void {
16 dismissedTurnByThreadKey.delete(threadKey);
18​
19export function isPlanSidebarDismissedForTurn(threadKey: string, turnKey: string): boolean {
20 return dismissedTurnByThreadKey.get(threadKey) === turnKey;