mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-24 10:09:01 -06:00
The main thread's Workers tracked no rendered-thumbnail cache until the first render request carried one. If Clear Preview Cache ran before that (e.g. starting on an empty filtered view), the per-frame observation in finished() had nothing to compare with, and the first request only recorded the already-cleared generation as its baseline. The persisted ThumbIndex was never invalidated, so once the filter was removed the request touched the old entry and the worker read the pre-clear JPEG back from browser storage. Replacing the cache (another library) before the first request had the same gap. Workers::start now takes the session's cache and records it, with its current generation, as the baseline the persisted index belongs to. A normal start with no clear observes the same cache and generation and keeps the index. The comparison moves into wire::CacheWatch so it is tested natively (cargo test --workspace) next to ThumbIndex. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>