diff options
| author | adamelmore <[email protected]> | 2026-01-26 12:58:46 -0600 |
|---|---|---|
| committer | adamelmore <[email protected]> | 2026-01-26 12:58:51 -0600 |
| commit | 319ad2a3916862adaedcc52a8b88d8e131516b1f (patch) | |
| tree | 00aef77e22ad352e4502382c44c7748671972bfa /packages/app/src/pages | |
| parent | de3b654dcd195448f1d19e55562b2d84a2db7c91 (diff) | |
| download | opencode-319ad2a3916862adaedcc52a8b88d8e131516b1f.tar.gz opencode-319ad2a3916862adaedcc52a8b88d8e131516b1f.zip | |
fix(app): session load cap
Diffstat (limited to 'packages/app/src/pages')
| -rw-r--r-- | packages/app/src/pages/layout.tsx | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/packages/app/src/pages/layout.tsx b/packages/app/src/pages/layout.tsx index fd6f6e527..b13cb1ac3 100644 --- a/packages/app/src/pages/layout.tsx +++ b/packages/app/src/pages/layout.tsx @@ -1592,6 +1592,7 @@ export default function Layout(props: ParentProps) { mobile?: boolean dense?: boolean popover?: boolean + children?: Map<string, string[]> }): JSX.Element => { const notification = useNotification() const notifications = createMemo(() => notification.session.unseen(props.session.id)) @@ -1600,6 +1601,16 @@ export default function Layout(props: ParentProps) { const hasPermissions = createMemo(() => { const permissions = sessionStore.permission?.[props.session.id] ?? [] if (permissions.length > 0) return true + + const childIDs = props.children?.get(props.session.id) + if (childIDs) { + for (const id of childIDs) { + const childPermissions = sessionStore.permission?.[id] ?? [] + if (childPermissions.length > 0) return true + } + return false + } + const childSessions = sessionStore.session.filter((s) => s.parentID === props.session.id) for (const child of childSessions) { const childPermissions = sessionStore.permission?.[child.id] ?? [] @@ -1898,6 +1909,19 @@ export default function Layout(props: ParentProps) { .filter((session) => !session.parentID && !session.time?.archived) .toSorted(sortSessions(Date.now())), ) + const children = createMemo(() => { + const map = new Map<string, string[]>() + for (const session of workspaceStore.session) { + if (!session.parentID) continue + const existing = map.get(session.parentID) + if (existing) { + existing.push(session.id) + continue + } + map.set(session.parentID, [session.id]) + } + return map + }) const local = createMemo(() => props.directory === props.project.worktree) const active = createMemo(() => { const current = params.dir ? base64Decode(params.dir) : "" @@ -1911,10 +1935,9 @@ export default function Layout(props: ParentProps) { const open = createMemo(() => store.workspaceExpanded[props.directory] ?? local()) const boot = createMemo(() => open() || active()) const loading = createMemo(() => open() && workspaceStore.status !== "complete" && sessions().length === 0) - const hasMore = createMemo(() => local() && workspaceStore.sessionTotal > workspaceStore.session.length) + const hasMore = createMemo(() => workspaceStore.sessionTotal > sessions().length) const busy = createMemo(() => isBusy(props.directory)) const loadMore = async () => { - if (!local()) return setWorkspaceStore("limit", (limit) => limit + 5) await globalSync.project.loadSessions(props.directory) } @@ -2073,7 +2096,9 @@ export default function Layout(props: ParentProps) { <SessionSkeleton /> </Show> <For each={sessions()}> - {(session) => <SessionItem session={session} slug={slug()} mobile={props.mobile} />} + {(session) => ( + <SessionItem session={session} slug={slug()} mobile={props.mobile} children={children()} /> + )} </For> <Show when={hasMore()}> <div class="relative w-full py-1"> @@ -2288,8 +2313,21 @@ export default function Layout(props: ParentProps) { .filter((session) => !session.parentID && !session.time?.archived) .toSorted(sortSessions(Date.now())), ) + const children = createMemo(() => { + const map = new Map<string, string[]>() + for (const session of workspaceStore.session) { + if (!session.parentID) continue + const existing = map.get(session.parentID) + if (existing) { + existing.push(session.id) + continue + } + map.set(session.parentID, [session.id]) + } + return map + }) const loading = createMemo(() => workspaceStore.status !== "complete" && sessions().length === 0) - const hasMore = createMemo(() => workspaceStore.sessionTotal > workspaceStore.session.length) + const hasMore = createMemo(() => workspaceStore.sessionTotal > sessions().length) const loadMore = async () => { setWorkspaceStore("limit", (limit) => limit + 5) await globalSync.project.loadSessions(props.project.worktree) @@ -2308,7 +2346,7 @@ export default function Layout(props: ParentProps) { <SessionSkeleton /> </Show> <For each={sessions()}> - {(session) => <SessionItem session={session} slug={slug()} mobile={props.mobile} />} + {(session) => <SessionItem session={session} slug={slug()} mobile={props.mobile} children={children()} />} </For> <Show when={hasMore()}> <div class="relative w-full py-1"> |
