Skip to content

Commit c68f153

Browse files
perf(app): switch map thumbnails to _800.webp variant
_400.webp pixelates very quickly when the user zooms into the force-graph canvas — the 22-graph-unit nodes blow up to hundreds of on-screen pixels and the 400px source can't keep up. Bump the variant to _800.webp: stays crisp under typical zoom-in, total payload still only ~5 MB for 312 specs (vs ~15 MB for full-size originals). Refs #5646 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c2d72d1 commit c68f153

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

app/src/pages/MapPage.helpers.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ describe('buildKNNLinks', () => {
160160

161161

162162
describe('selectMapThumbUrl', () => {
163-
it('returns the _400.webp variant for the current theme', () => {
163+
it('returns the _800.webp variant for the current theme', () => {
164164
const s = spec('a', null);
165-
expect(selectMapThumbUrl(s, true)).toBe('https://example.com/a-dark_400.webp');
166-
expect(selectMapThumbUrl(s, false)).toBe('https://example.com/a-light_400.webp');
165+
expect(selectMapThumbUrl(s, true)).toBe('https://example.com/a-dark_800.webp');
166+
expect(selectMapThumbUrl(s, false)).toBe('https://example.com/a-light_800.webp');
167167
});
168168

169169
it('falls back to the other theme variant when the preferred URL is missing', () => {
170170
const s: SpecMapItem = { ...spec('a', null), preview_url_dark: null };
171-
expect(selectMapThumbUrl(s, true)).toBe('https://example.com/a-light_400.webp');
171+
expect(selectMapThumbUrl(s, true)).toBe('https://example.com/a-light_800.webp');
172172
});
173173

174174
it('returns null when no preview URLs at all', () => {

app/src/pages/MapPage.helpers.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ export function buildKNNLinks(
144144

145145
/**
146146
* Pick the best thumbnail URL for the current theme and downsize it to the
147-
* `_400.webp` variant produced by the responsive-image pipeline. Map nodes
148-
* render at ~22 px, so even 400 px is overkill — but 400 is the smallest
149-
* pipeline-baked variant. Going from full-size (~40–100 KB) to _400.webp
150-
* (~6 KB) cuts the 312-thumbnail payload from ~15 MB to ~2 MB.
147+
* `_800.webp` variant produced by the responsive-image pipeline. _800 stays
148+
* crisp under typical zoom-in (the smaller _400 variant pixelates quickly),
149+
* while keeping the 312-thumbnail payload at ~5 MB total instead of the
150+
* ~15 MB the full-size originals would cost.
151151
*
152152
* Falls back to the original full-size URL if the convention can't be
153153
* applied (e.g. URL doesn't end in `.png`).
@@ -156,7 +156,7 @@ export function selectMapThumbUrl(spec: SpecMapItem, isDark: boolean): string |
156156
const full = selectPreviewUrl(spec, isDark);
157157
if (!full) return null;
158158
if (!full.endsWith('.png')) return full;
159-
return full.replace(/\.png$/, '_400.webp');
159+
return full.replace(/\.png$/, '_800.webp');
160160
}
161161

162162
/**

0 commit comments

Comments
 (0)