fix(desktop): navigate to branched session
This commit is contained in:
committed by
brooklyn!
parent
78eb4ebbfc
commit
30252eccce
@@ -1714,8 +1714,11 @@ describe('branchStoredSession desktop source tagging', () => {
|
||||
await expect(branchStoredSession!('stored-parent')).resolves.toBe(true)
|
||||
|
||||
// The branch becomes the primary session — this is what routes the main
|
||||
// workspace area to it, not just a new sidebar row.
|
||||
// workspace area to it, not just a new sidebar row. Selection alone is not
|
||||
// enough: leaving the URL on the parent makes chat/index see a permanent
|
||||
// routeSessionMismatch and keeps the central loader mounted.
|
||||
expect($selectedStoredSessionId.get()).toBe('branch-stored')
|
||||
expect(navigate).toHaveBeenCalledWith(sessionRoute('branch-stored'), { replace: true })
|
||||
// It must not ALSO exist as a tile: a session is either the main thread or
|
||||
// a tile, never both (resumeSession closes any tile with the same id).
|
||||
expect($sessionTiles.get().some(tile => tile.storedSessionId === 'branch-stored')).toBe(false)
|
||||
@@ -1767,6 +1770,7 @@ describe('branchStoredSession desktop source tagging', () => {
|
||||
// Branching a session that is not the one currently open must not steal
|
||||
// the user's active view — "stored-other" stays selected.
|
||||
expect($selectedStoredSessionId.get()).toBe('stored-other')
|
||||
expect(navigate).not.toHaveBeenCalled()
|
||||
// The branch instead opens as its own tile.
|
||||
expect($sessionTiles.get().some(tile => tile.storedSessionId === 'branch-stored')).toBe(true)
|
||||
})
|
||||
|
||||
@@ -2079,6 +2079,7 @@ export function useSessionActions({
|
||||
// unconditionally). resumeSession reuses the runtime warm-cached above
|
||||
// (ensureSessionState/updateSessionState) instead of an extra resume RPC.
|
||||
if (parentStoredId !== null && selectedStoredSessionIdRef.current === parentStoredId) {
|
||||
navigate(sessionRoute(routedSessionId), { replace: true })
|
||||
await resumeSession(routedSessionId)
|
||||
} else {
|
||||
// Carry the exact owner onto the tile: its persisted ownerRoute is
|
||||
@@ -2113,6 +2114,7 @@ export function useSessionActions({
|
||||
copy,
|
||||
creatingSessionRef,
|
||||
ensureSessionState,
|
||||
navigate,
|
||||
requestGateway,
|
||||
resumeSession,
|
||||
selectedStoredSessionIdRef,
|
||||
|
||||
Reference in New Issue
Block a user