MCPcopy Create free account
hub / github.com/anomalyco/opencode / pruneView

Function pruneView

packages/app/src/context/file/view-cache.ts:51–65  ·  view source on GitHub ↗
(keep?: string)

Source from the content-addressed store, hash-verified

49 const meta = { pruned: false }
50
51 const pruneView = (keep?: string) => {
52 const keys = Object.keys(view.file)
53 if (keys.length <= MAX_VIEW_FILES) return
54
55 const drop = keys.filter((key) => key !== keep).slice(0, keys.length - MAX_VIEW_FILES)
56 if (drop.length === 0) return
57
58 setView(
59 produce((draft) => {
60 for (const key of drop) {
61 delete draft.file[key]
62 }
63 }),
64 )
65 }
66
67 createEffect(() => {
68 if (!ready()) return

Callers 4

createViewSessionFunction · 0.85
setScrollTopFunction · 0.85
setScrollLeftFunction · 0.85
setSelectedLinesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected