@@ -7,22 +7,23 @@ import { lineageIncludes, turnsById } from './lineage';
77export interface ParkedLineage {
88 /** The leaf the timeline reads toward. */
99 leafTurnId : TurnId ;
10- /** The graph revision when the viewer parked; a later one means the conversation moved on
11- * elsewhere while this viewer stayed. */
12- atRevision : number ;
13- /** The revision whose "continued elsewhere" chip the viewer dismissed. */
14- dismissedRevision : number | null ;
10+ /** The host default when the viewer parked; a different one means the conversation moved on
11+ * elsewhere while this viewer stayed — a failed attempt or a settle, which only bump the
12+ * revision, is nobody's news. */
13+ sinceLeafTurnId : TurnId | undefined ;
14+ /** The host default whose "continued elsewhere" chip the viewer dismissed. */
15+ dismissedLeafTurnId : TurnId | undefined ;
1516}
1617
1718interface LineageState {
1819 parkedBySession : Record < string , ParkedLineage > ;
1920 /** Remembered descent per parent (`lineageParentKey`): `‹ ›` returns to the version last viewed. */
2021 preferredChildBySession : Record < string , Record < string , TurnId > > ;
21- park : ( sessionId : SessionId , leafTurnId : TurnId , atRevision : number ) => void ;
22+ park : ( sessionId : SessionId , leafTurnId : TurnId , activeLeafTurnId : TurnId | undefined ) => void ;
2223 /** Back to the host default: the active lineage, following it live. */
2324 follow : ( sessionId : SessionId ) => void ;
2425 rememberChild : ( sessionId : SessionId , parentKey : string , childTurnId : TurnId ) => void ;
25- dismissElsewhere : ( sessionId : SessionId , revision : number ) => void ;
26+ dismissElsewhere : ( sessionId : SessionId , activeLeafTurnId : TurnId | undefined ) => void ;
2627 /** A fresh graph snapshot: once the host default runs through the parked leaf — the viewer's
2728 * own edit or continue landed, or a plain send extended the version it was on — the view is at
2829 * that lineage's tip again and follows. */
@@ -43,11 +44,15 @@ function without<T>(record: Record<string, T>, key: string): Record<string, T> {
4344export const useLineageStore = create < LineageState > ( ) ( ( set ) => ( {
4445 parkedBySession : { } ,
4546 preferredChildBySession : { } ,
46- park : ( sessionId , leafTurnId , atRevision ) =>
47+ park : ( sessionId , leafTurnId , activeLeafTurnId ) =>
4748 set ( ( state ) => ( {
4849 parkedBySession : {
4950 ...state . parkedBySession ,
50- [ sessionId ] : { leafTurnId, atRevision, dismissedRevision : null } ,
51+ [ sessionId ] : {
52+ leafTurnId,
53+ sinceLeafTurnId : activeLeafTurnId ,
54+ dismissedLeafTurnId : undefined ,
55+ } ,
5156 } ,
5257 } ) ) ,
5358 follow : ( sessionId ) =>
@@ -63,14 +68,14 @@ export const useLineageStore = create<LineageState>()((set) => ({
6368 [ sessionId ] : { ...state . preferredChildBySession [ sessionId ] , [ parentKey ] : childTurnId } ,
6469 } ,
6570 } ) ) ,
66- dismissElsewhere : ( sessionId , revision ) =>
71+ dismissElsewhere : ( sessionId , activeLeafTurnId ) =>
6772 set ( ( state ) => {
6873 const parked = state . parkedBySession [ sessionId ] ;
6974 if ( parked === undefined ) return state ;
7075 return {
7176 parkedBySession : {
7277 ...state . parkedBySession ,
73- [ sessionId ] : { ...parked , dismissedRevision : revision } ,
78+ [ sessionId ] : { ...parked , dismissedLeafTurnId : activeLeafTurnId } ,
7479 } ,
7580 } ;
7681 } ) ,
0 commit comments