fix(tui): preserve session location during handoff (#39886)

This commit is contained in:
Kit Langton 2026-07-31 10:54:36 -04:00 committed by GitHub
commit 1311d909a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 112 additions and 2 deletions

View file

@ -646,7 +646,10 @@ function App(props: { pair?: DialogPairCredentials }) {
run: () => {
route.navigate({
type: "home",
location: route.data.type === "session" ? data.session.get(route.data.sessionID)?.location : undefined,
location:
route.data.type === "session"
? (data.session.get(route.data.sessionID)?.location ?? location.ref)
: undefined,
})
dialog.clear()
},

View file

@ -84,6 +84,7 @@ export function DialogOpen() {
value: { type: "session", sessionID: session.id } as OpenTarget,
category: "Sessions",
footer: `${name ? `${Locale.truncate(name, 20)} · ` : ""}${timeAgo(session.time.updated)}`,
onSelect: () => location.set(session.location),
gutter: running
? () => <Spinner />
: tabs.has(session.id)

View file

@ -143,8 +143,8 @@ export function Session() {
const promptRef = usePromptRef()
const session = createMemo(() => data.session.get(route.sessionID))
const messages = () => data.session.message.list(route.sessionID)
const location = createMemo(() => session()?.location)
const currentLocation = useLocation()
const location = createMemo(() => session()?.location ?? currentLocation.ref)
createEffect(() => currentLocation.set(location()))