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:
@@ -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
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user