mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
revert(renderer): restore the module-local agent-status memo; a graphState field needs a banned cast
This commit is contained in:
@@ -67,7 +67,6 @@ export const graphState = {
|
||||
cachedOpenFilesProjection: null as OpenFilesProjectionCache | null,
|
||||
cachedBrowserWorkspacesProjection: null as BrowserWorkspacesProjectionCache | null,
|
||||
cachedBrowserPagesProjection: null as BrowserPagesProjectionCache | null,
|
||||
cachedMobileSessionAgentStatus: null as MobileSessionAgentStatusCache | null,
|
||||
cachedOpenFileIndexesSource: null as AppState['openFiles'] | null,
|
||||
cachedOpenFileIndexes: null as OpenFileIndexes | null,
|
||||
cachedEditorDraftHashes: null as EditorDraftHashCache | null,
|
||||
@@ -77,11 +76,22 @@ export const graphState = {
|
||||
hasCachedMobileTerminalTheme: false
|
||||
}
|
||||
|
||||
// Module-local rather than `graphState` fields: a nullable field on that object literal needs an
|
||||
// `as` cast, which the changed-code casting gate rejects.
|
||||
let terminalTabOwnershipIndexCache: TerminalTabOwnershipIndex | null = null
|
||||
let mobileSessionAgentStatusCache: MobileSessionAgentStatusCache | null = null
|
||||
|
||||
export function getMobileSessionAgentStatusCache(): MobileSessionAgentStatusCache | null {
|
||||
return mobileSessionAgentStatusCache
|
||||
}
|
||||
|
||||
export function setMobileSessionAgentStatusCache(cache: MobileSessionAgentStatusCache): void {
|
||||
mobileSessionAgentStatusCache = cache
|
||||
}
|
||||
|
||||
export function resetRuntimeGraphSliceScanCaches(): void {
|
||||
terminalTabOwnershipIndexCache = null
|
||||
graphState.cachedMobileSessionAgentStatus = null
|
||||
mobileSessionAgentStatusCache = null
|
||||
}
|
||||
|
||||
export function registeredTerminalTabKey(
|
||||
|
||||
@@ -10,8 +10,10 @@ import {
|
||||
EMPTY_WORKTREE_TERMINAL_TABS,
|
||||
EMPTY_WORKTREE_UNIFIED_TABS,
|
||||
EMPTY_LAYOUT_BY_WORKTREE,
|
||||
getMobileSessionAgentStatusCache,
|
||||
getTerminalTabOwnershipIndex,
|
||||
graphState
|
||||
graphState,
|
||||
setMobileSessionAgentStatusCache
|
||||
} from './graph-state'
|
||||
import type {
|
||||
MobileSessionAgentStatusByWorktree,
|
||||
@@ -70,7 +72,7 @@ export function buildMobileSessionAgentStatusByWorktree(
|
||||
agentStatusByPaneKey: AppState['agentStatusByPaneKey'],
|
||||
tabsByWorktree: AppState['tabsByWorktree']
|
||||
): MobileSessionAgentStatusByWorktree {
|
||||
const cached = graphState.cachedMobileSessionAgentStatus
|
||||
const cached = getMobileSessionAgentStatusCache()
|
||||
if (cached?.agentStatusSource === agentStatusByPaneKey && cached.tabsSource === tabsByWorktree) {
|
||||
return cached.byWorktreeId
|
||||
}
|
||||
@@ -101,11 +103,11 @@ export function buildMobileSessionAgentStatusByWorktree(
|
||||
byWorktreeId.set(worktreeId, previousBucket)
|
||||
}
|
||||
}
|
||||
graphState.cachedMobileSessionAgentStatus = {
|
||||
setMobileSessionAgentStatusCache({
|
||||
agentStatusSource: agentStatusByPaneKey,
|
||||
tabsSource: tabsByWorktree,
|
||||
byWorktreeId
|
||||
}
|
||||
})
|
||||
return byWorktreeId
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user