mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 16:02:50 +00:00
perf(renderer): convert the four lazy-useRef sites that landed on main
This commit is contained in:
@@ -121,8 +121,10 @@ export function useAgentPaneThreads(args: {
|
||||
// identities across rebuilds, so a status write to one agent leaves every other row's
|
||||
// memo bail-out and cached search text intact. Rebuilds are deterministic, so a repeated
|
||||
// (StrictMode/deferred) memo invocation returns identical objects from the cache.
|
||||
const eventBuildCacheRef = useRef(createActivityEventBuildCache())
|
||||
const threadReuseCacheRef = useRef(createAgentPaneThreadReuseCache())
|
||||
const eventBuildCacheRef = useRef<ReturnType<typeof createActivityEventBuildCache>>(undefined!)
|
||||
eventBuildCacheRef.current ??= createActivityEventBuildCache()
|
||||
const threadReuseCacheRef = useRef<ReturnType<typeof createAgentPaneThreadReuseCache>>(undefined!)
|
||||
threadReuseCacheRef.current ??= createAgentPaneThreadReuseCache()
|
||||
|
||||
const { events: allEvents, liveAgentByPaneKey } = useMemo(
|
||||
() =>
|
||||
|
||||
@@ -51,7 +51,8 @@ export function useAgentBucketCounts(): AgentBucketCounts {
|
||||
|
||||
// Why a per-hook cache: unrelated status/title writes change one worktree's inputs;
|
||||
// the cache keeps every other worktree's counts without rerunning its row pipeline.
|
||||
const cacheRef = useRef(createDashboardBucketCountsCache())
|
||||
const cacheRef = useRef<ReturnType<typeof createDashboardBucketCountsCache>>(undefined!)
|
||||
cacheRef.current ??= createDashboardBucketCountsCache()
|
||||
return useMemo(() => {
|
||||
return buildDashboardBucketCounts(
|
||||
{
|
||||
|
||||
@@ -11,7 +11,8 @@ import { createWorktreeAgentRowsCache } from './worktree-agent-rows-cache'
|
||||
* is no relay, so we derive it here from the same builder the bridge uses.
|
||||
*/
|
||||
export function useLiveDashboardSnapshot(): DashboardSnapshot {
|
||||
const rowsCacheRef = useRef(createWorktreeAgentRowsCache())
|
||||
const rowsCacheRef = useRef<ReturnType<typeof createWorktreeAgentRowsCache>>(undefined!)
|
||||
rowsCacheRef.current ??= createWorktreeAgentRowsCache()
|
||||
const repos = useAppStore((s) => s.repos)
|
||||
const worktreesByRepo = useAppStore((s) => s.worktreesByRepo)
|
||||
const tabsByWorktree = useAppStore((s) => s.tabsByWorktree)
|
||||
|
||||
Reference in New Issue
Block a user