mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-24 19:24:22 +01:00
tui: show more sessions in list and fix sync timing to prevent race conditions
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 }),
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user