Prefetch low-res CT on card hover (viewer feels instant)#79
Merged
Conversation
Cards already warm the viewer JS chunk on hover (prefetchViewer). This also warms the low-res CT after a short hover dwell, so clicking a card pays only decode + render instead of the download. Volume responses are immutable (7-day cache), so the prefetched CT is reused straight from cache on click. Bandwidth-safe on shared infra: CT only (never the mask), each case fetched at most once, a global concurrency cap so hovering across the grid can't stampede the backend, and a 150ms hover dwell so skimming doesn't fetch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Extends the existing hover warm-up on dataset cards. Today
onMouseEnterwarms the viewer JS chunk (prefetchViewer); this also warms the low-res CT after a short hover dwell, so clicking a card pays only decode + render instead of the download. This is the biggest perceived-latency win from the speed plan.Volume responses are immutable (
Cache-Control: max-age=604800, immutable), so a prefetched CT is reused straight from the browser cache on click.Safety (shared JHU infra)
Files
helpers/prefetchVolume.ts(new) — queued, capped, deduped low-res CT prefetchercomponents/Preview.tsx— dwell-timer on the card hover, cleared on leaveTesting
tsc -bcleanNot included (deliberately) — #3 and #4 from the speed plan
Both rewrite the viewer's WebGL init/load path, which can't be validated locally (jsdom has no GPU; this checkout has no image data), so shipping them blind risks black-screening the viewer:
renderVisualization.Recommend doing those as a follow-up with testing against real data on the server.