summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/context
diff options
context:
space:
mode:
authorShane Bishop <[email protected]>2026-01-14 05:36:08 -0800
committerGitHub <[email protected]>2026-01-14 07:36:08 -0600
commit077ca4454f152176328496bf0ab3b3d44c2fba9d (patch)
treeb7ac3970dc65a4cc481f8a98f4fe552cd47fa5ff /packages/app/src/context
parent05cbb11709de3d05623fee83fdb9c255471389e9 (diff)
downloadopencode-077ca4454f152176328496bf0ab3b3d44c2fba9d.tar.gz
opencode-077ca4454f152176328496bf0ab3b3d44c2fba9d.zip
fix(desktop): "load more" button behavior in desktop sidebar (#8430)
Diffstat (limited to 'packages/app/src/context')
-rw-r--r--packages/app/src/context/global-sync.tsx12
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/app/src/context/global-sync.tsx b/packages/app/src/context/global-sync.tsx
index c11edd292..ea0b90d5d 100644
--- a/packages/app/src/context/global-sync.tsx
+++ b/packages/app/src/context/global-sync.tsx
@@ -38,6 +38,7 @@ type State = {
config: Config
path: Path
session: Session[]
+ sessionTotal: number
session_status: {
[sessionID: string]: SessionStatus
}
@@ -98,6 +99,7 @@ function createGlobalSync() {
agent: [],
command: [],
session: [],
+ sessionTotal: 0,
session_status: {},
session_diff: {},
todo: {},
@@ -117,8 +119,10 @@ function createGlobalSync() {
async function loadSessions(directory: string) {
const [store, setStore] = child(directory)
- globalSDK.client.session
- .list({ directory })
+ const limit = store.limit
+
+ return globalSDK.client.session
+ .list({ directory, roots: true })
.then((x) => {
const fourHoursAgo = Date.now() - 4 * 60 * 60 * 1000
const nonArchived = (x.data ?? [])
@@ -128,10 +132,12 @@ function createGlobalSync() {
.sort((a, b) => a.id.localeCompare(b.id))
// Include up to the limit, plus any updated in the last 4 hours
const sessions = nonArchived.filter((s, i) => {
- if (i < store.limit) return true
+ if (i < limit) return true
const updated = new Date(s.time?.updated ?? s.time?.created).getTime()
return updated > fourHoursAgo
})
+ // Store total session count (used for "load more" pagination)
+ setStore("sessionTotal", nonArchived.length)
setStore("session", reconcile(sessions, { key: "id" }))
})
.catch((err) => {