Преглед на файлове

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

Dax Raad преди 3 месеца
родител
ревизия
1a2b3701f2

+ 1 - 1
packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx

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

+ 1 - 1
packages/opencode/src/cli/cmd/tui/context/sync.tsx

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

+ 0 - 2
packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx

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