tui: show more sessions in list and fix sync timing to prevent race conditions

This commit is contained in:
Dax Raad
2025-11-07 16:19:38 -05:00
parent 0a395d8783
commit 1a2b3701f2
3 changed files with 2 additions and 4 deletions

View File

@@ -43,6 +43,7 @@ export function DialogSessionList() {
footer: Locale.time(x.time.updated),
}
})
.slice(0, 150)
})
createEffect(() => {
@@ -57,7 +58,6 @@ export function DialogSessionList() {
<DialogSelect
title="Sessions"
options={options()}
limit={50}
current={currentSessionID()}
onMove={() => {
setToDelete(undefined)

View File

@@ -269,8 +269,8 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
return last.time.completed ? "idle" : "working"
},
async sync(sessionID: string) {
const now = Date.now()
if (store.message[sessionID]) return
const now = Date.now()
console.log("syncing", sessionID)
const [session, messages, todo, diff] = await Promise.all([
sdk.client.session.get({ path: { id: sessionID }, throwOnError: true }),

View File

@@ -23,7 +23,6 @@ export interface DialogSelectProps<T> {
title: string
onTrigger: (option: DialogSelectOption<T>) => void
}[]
limit?: number
current?: T
}
@@ -58,7 +57,6 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
const result = pipe(
props.options,
filter((x) => x.disabled !== true),
take(props.limit ?? Infinity),
(x) =>
!needle ? x : fuzzysort.go(needle, x, { keys: ["title", "category"] }).map((x) => x.obj),
)