mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-16 02:22:17 +00:00
perf(sprites): serve grid-sized thumbnails from an immutable URL space
Every grid cell downloaded the full detail sprite. Generate a smaller /sprites-grid/v1/ set at build time and let the grid ask for those first, falling back through the existing detail URLs when a thumbnail is missing so detail resolution is unchanged. The new prefix is versioned, so it can be cached forever, and the service worker recognises it alongside the other sprite roots. The placeholder is now an empty box rather than a spinner: a thousand spinners cost layout work and announced nothing useful.
This commit is contained in:
@@ -74,7 +74,7 @@ async function missingSprites(cache, root) {
|
||||
|
||||
// Covers both the local `/sprites-small/...` folder and the GitHub-hosted copy of it.
|
||||
function isSpriteUrl(url) {
|
||||
return /\/sprites(-small)?\//.test(url.pathname) && url.pathname.endsWith('.webp');
|
||||
return /\/sprites(?:-small|-grid\/v1)?\//.test(url.pathname) && url.pathname.endsWith('.webp');
|
||||
}
|
||||
|
||||
async function currentOfflineMeta() {
|
||||
|
||||
Reference in New Issue
Block a user