summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/context
diff options
context:
space:
mode:
authorAdam <[email protected]>2026-02-18 11:02:41 -0600
committerAdam <[email protected]>2026-02-18 11:48:25 -0600
commitef14f64f9ee10ee7945a547bde4b13d6dcf2f0bd (patch)
tree56e755687a04ded0c7c6469ad96836331e88dd94 /packages/app/src/context
parent3f60a6c2a46dab1622ee4f4c99e4dfad876f3a3c (diff)
downloadopencode-ef14f64f9ee10ee7945a547bde4b13d6dcf2f0bd.tar.gz
opencode-ef14f64f9ee10ee7945a547bde4b13d6dcf2f0bd.zip
chore: cleanup
Diffstat (limited to 'packages/app/src/context')
-rw-r--r--packages/app/src/context/global-sync.test.ts10
-rw-r--r--packages/app/src/context/global-sync.tsx31
-rw-r--r--packages/app/src/context/global-sync/child-store.test.ts2
-rw-r--r--packages/app/src/context/global-sync/child-store.ts5
-rw-r--r--packages/app/src/context/global-sync/session-load.ts1
-rw-r--r--packages/app/src/context/global-sync/types.ts1
6 files changed, 0 insertions, 50 deletions
diff --git a/packages/app/src/context/global-sync.test.ts b/packages/app/src/context/global-sync.test.ts
index 396b41231..7956057fd 100644
--- a/packages/app/src/context/global-sync.test.ts
+++ b/packages/app/src/context/global-sync.test.ts
@@ -30,7 +30,6 @@ describe("pickDirectoriesToEvict", () => {
describe("loadRootSessionsWithFallback", () => {
test("uses limited roots query when supported", async () => {
const calls: Array<{ directory: string; roots: true; limit?: number }> = []
- let fallback = 0
const result = await loadRootSessionsWithFallback({
directory: "dir",
@@ -39,20 +38,15 @@ describe("loadRootSessionsWithFallback", () => {
calls.push(query)
return { data: [] }
},
- onFallback: () => {
- fallback += 1
- },
})
expect(result.data).toEqual([])
expect(result.limited).toBe(true)
expect(calls).toEqual([{ directory: "dir", roots: true, limit: 10 }])
- expect(fallback).toBe(0)
})
test("falls back to full roots query on limited-query failure", async () => {
const calls: Array<{ directory: string; roots: true; limit?: number }> = []
- let fallback = 0
const result = await loadRootSessionsWithFallback({
directory: "dir",
@@ -62,9 +56,6 @@ describe("loadRootSessionsWithFallback", () => {
if (query.limit) throw new Error("unsupported")
return { data: [] }
},
- onFallback: () => {
- fallback += 1
- },
})
expect(result.data).toEqual([])
@@ -73,7 +64,6 @@ describe("loadRootSessionsWithFallback", () => {
{ directory: "dir", roots: true, limit: 25 },
{ directory: "dir", roots: true },
])
- expect(fallback).toBe(1)
})
})
diff --git a/packages/app/src/context/global-sync.tsx b/packages/app/src/context/global-sync.tsx
index 4f3664d8e..7e242130f 100644
--- a/packages/app/src/context/global-sync.tsx
+++ b/packages/app/src/context/global-sync.tsx
@@ -57,14 +57,6 @@ function errorMessage(error: unknown) {
return "Unknown error"
}
-function setDevStats(value: {
- activeDirectoryStores: number
- evictions: number
- loadSessionsFullFetchFallback: number
-}) {
- ;(globalThis as { __OPENCODE_GLOBAL_SYNC_STATS?: typeof value }).__OPENCODE_GLOBAL_SYNC_STATS = value
-}
-
function createGlobalSync() {
const globalSDK = useGlobalSDK()
const platform = usePlatform()
@@ -72,11 +64,6 @@ function createGlobalSync() {
const owner = getOwner()
if (!owner) throw new Error("GlobalSync must be created within owner")
- const stats = {
- evictions: 0,
- loadSessionsFallback: 0,
- }
-
const sdkCache = new Map<string, OpencodeClient>()
const booting = new Map<string, Promise<void>>()
const sessionLoads = new Map<string, Promise<void>>()
@@ -112,15 +99,6 @@ function createGlobalSync() {
setGlobalStore("session_todo", sessionID, reconcile(todos, { key: "id" }))
}
- const updateStats = (activeDirectoryStores: number) => {
- if (!import.meta.env.DEV) return
- setDevStats({
- activeDirectoryStores,
- evictions: stats.evictions,
- loadSessionsFullFetchFallback: stats.loadSessionsFallback,
- })
- }
-
const paused = () => untrack(() => globalStore.reload) !== undefined
const queue = createRefreshQueue({
@@ -131,11 +109,6 @@ function createGlobalSync() {
const children = createChildStoreManager({
owner,
- markStats: updateStats,
- incrementEvictions: () => {
- stats.evictions += 1
- updateStats(Object.keys(children.children).length)
- },
isBooting: (directory) => booting.has(directory),
isLoadingSessions: (directory) => sessionLoads.has(directory),
onBootstrap: (directory) => {
@@ -207,10 +180,6 @@ function createGlobalSync() {
directory,
limit,
list: (query) => globalSDK.client.session.list(query),
- onFallback: () => {
- stats.loadSessionsFallback += 1
- updateStats(Object.keys(children.children).length)
- },
})
.then((x) => {
const nonArchived = (x.data ?? [])
diff --git a/packages/app/src/context/global-sync/child-store.test.ts b/packages/app/src/context/global-sync/child-store.test.ts
index 500f0fc70..cec76ff87 100644
--- a/packages/app/src/context/global-sync/child-store.test.ts
+++ b/packages/app/src/context/global-sync/child-store.test.ts
@@ -17,8 +17,6 @@ describe("createChildStoreManager", () => {
const manager = createChildStoreManager({
owner,
- markStats() {},
- incrementEvictions() {},
isBooting: () => false,
isLoadingSessions: () => false,
onBootstrap() {},
diff --git a/packages/app/src/context/global-sync/child-store.ts b/packages/app/src/context/global-sync/child-store.ts
index af08c3bd4..2fe5b7830 100644
--- a/packages/app/src/context/global-sync/child-store.ts
+++ b/packages/app/src/context/global-sync/child-store.ts
@@ -17,8 +17,6 @@ import { canDisposeDirectory, pickDirectoriesToEvict } from "./eviction"
export function createChildStoreManager(input: {
owner: Owner
- markStats: (activeDirectoryStores: number) => void
- incrementEvictions: () => void
isBooting: (directory: string) => boolean
isLoadingSessions: (directory: string) => boolean
onBootstrap: (directory: string) => void
@@ -102,7 +100,6 @@ export function createChildStoreManager(input: {
}
delete children[directory]
input.onDispose(directory)
- input.markStats(Object.keys(children).length)
return true
}
@@ -120,7 +117,6 @@ export function createChildStoreManager(input: {
if (list.length === 0) return
for (const directory of list) {
if (!disposeDirectory(directory)) continue
- input.incrementEvictions()
}
}
@@ -200,7 +196,6 @@ export function createChildStoreManager(input: {
})
runWithOwner(input.owner, init)
- input.markStats(Object.keys(children).length)
}
mark(directory)
const childStore = children[directory]
diff --git a/packages/app/src/context/global-sync/session-load.ts b/packages/app/src/context/global-sync/session-load.ts
index 443aa8450..3693dcb46 100644
--- a/packages/app/src/context/global-sync/session-load.ts
+++ b/packages/app/src/context/global-sync/session-load.ts
@@ -9,7 +9,6 @@ export async function loadRootSessionsWithFallback(input: RootLoadArgs) {
limited: true,
} as const
} catch {
- input.onFallback()
const result = await input.list({ directory: input.directory, roots: true })
return {
data: result.data,
diff --git a/packages/app/src/context/global-sync/types.ts b/packages/app/src/context/global-sync/types.ts
index ade0b973a..c61dc337d 100644
--- a/packages/app/src/context/global-sync/types.ts
+++ b/packages/app/src/context/global-sync/types.ts
@@ -119,7 +119,6 @@ export type RootLoadArgs = {
directory: string
limit: number
list: (query: { directory: string; roots: true; limit?: number }) => Promise<{ data?: Session[] }>
- onFallback: () => void
}
export type RootLoadResult = {