fix(app): close missing session tabs (#33785)

This commit is contained in:
Brendan Allan 2026-06-25 13:28:32 +08:00 committed by GitHub
commit bdee94ca40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 73 additions and 22 deletions

View file

@ -58,6 +58,7 @@ import {
selectSessionLineage,
sessionHref,
} from "./utils/session-route"
import { isSessionNotFoundError } from "./utils/server-errors"
import Session from "@/pages/session"
import { NewHome, LegacyHome } from "@/pages/home"
@ -129,9 +130,13 @@ function ResolvedTargetSessionRoute() {
const [resolved] = createResource(
() => {
if (cached()) return
return { id: params.id, sync: sync() }
return { id: params.id, server: serverKey(), sync: sync() }
},
({ id, sync }) => sync.session.lineage.resolve(id),
({ id, server, sync }) =>
sync.session.lineage.resolve(id).catch((error) => {
if (isSessionNotFoundError(error, id)) tabs.removeSessionTab({ server, sessionId: id })
throw error
}),
)
const current = createMemo(() => selectSessionLineage(params.id, cached(), resolved()))
const directory = createMemo(() => current()?.session.directory)