web: LRU screen cache to bound memory in long sessions (#10063)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-03-18 08:50:48 -07:00
committed by GitHub
parent 317ce2b3da
commit 530afe87c7
2 changed files with 59 additions and 14 deletions
+5 -1
View File
@@ -42,7 +42,11 @@ export function useWebScrollRestoration() {
() => ({
focus(e: EventArg<'focus', boolean | undefined, unknown>) {
const scrollY = state.scrollYs.get(e.target) ?? 0
window.scrollTo(0, scrollY)
// Deferred so that screens re-mounted by LRU eviction have
// time to render their content before we scroll.
requestAnimationFrame(() => {
window.scrollTo(0, scrollY)
})
state.focusedKey = e.target ?? null
},
}),