fix(tui): resolve session_status TypeError (#5520)

This commit is contained in:
Ravi Kumar 2025-12-17 23:08:05 +05:30 committed by GitHub
parent b5e97eb338
commit 69e562125d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View file

@ -37,7 +37,7 @@ export function DialogSessionList() {
category = "Today"
}
const isDeleting = toDelete() === x.id
const status = sync.data.session_status[x.id]
const status = sync.data.session_status?.[x.id]
const isWorking = status?.type === "busy"
return {
title: isDeleting ? `Press ${deleteKeybind} again to confirm` : x.title,

View file

@ -116,7 +116,7 @@ export function Prompt(props: PromptProps) {
const sync = useSync()
const dialog = useDialog()
const toast = useToast()
const status = createMemo(() => sync.data.session_status[props.sessionID ?? ""] ?? { type: "idle" })
const status = createMemo(() => sync.data.session_status?.[props.sessionID ?? ""] ?? { type: "idle" })
const history = usePromptHistory()
const command = useCommandDialog()
const renderer = useRenderer()

View file

@ -340,7 +340,7 @@ export function Session() {
keybind: "messages_undo",
category: "Session",
onSelect: async (dialog) => {
const status = sync.data.session_status[route.sessionID]
const status = sync.data.session_status?.[route.sessionID]
if (status?.type !== "idle") await sdk.client.session.abort({ sessionID: route.sessionID }).catch(() => {})
const revert = session().revert?.messageID
const message = messages().findLast((x) => (!revert || x.id < revert) && x.role === "user")

View file

@ -55,7 +55,7 @@ export namespace SessionStatus {
}
export function list() {
return Object.values(state())
return state()
}
export function set(sessionID: string, status: Info) {