Files
immich-magic-proxy/app
Vignan Posham 06741b47bb Keep loaded gallery thumbnails mounted to stop scroll-back flicker
The gallery virtualiser removed a tile's <a>/<img> from the DOM whenever it
left the viewport ± 1 buffer and rebuilt it from scratch on re-entry, so
scrolling back up replayed the thumbhash placeholder and opacity fade on
thumbnails that were already loaded - even for small albums where no network
fetch happens.

Track tile indices whose <img> has fired `load` in a bounded, LRU-ordered
`stickyTiles` set. virtualize() keeps those tiles in the "needed" set so
syncRendered never unmounts them; not-yet-loaded tiles still get the normal
lazy create/remove + data-src treatment, so large albums keep lazy-loading
on first scroll-into-view.

The set is trimmed to STICKY_TILE_LIMIT (1500) each pass - currently visible
tiles are bumped to most-recently-used and the oldest off-screen overflow is
released back to normal virtualisation - so a very large album (100k+ photos)
cannot accumulate unbounded mounted DOM or retained image memory as the user
scrolls. Cleared on a layout recompute since tile geometry changes there.
Also adds a fast-path skip in loadVisibleTiles() for finished loads now that
the rendered-tile map can be larger.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-07 01:10:23 -04:00
..
2026-08-20 07:19:25 +12:00
2026-09-04 23:28:03 +12:00
2026-09-04 23:28:03 +12:00