Conversation
Cache-bust local /images/* URLs in reporter components using the comparison timestamp so baseline/current/diff re-fetch after each update.\n\nAlso disable caching for image responses in the assets router and add focused tests for URL versioning and cache headers.
PR Review: 🐛 Prevent stale TDD image loadsOverall this is a clean, well-scoped fix for a real and annoying caching issue. The approach is sound and the test coverage is good. A few observations below. ✅ What works well
🔍 Issues & Questions1. Double-rewrites on re-renders (minor) In 2.
3. if (version === null || version === undefined) {
return url;
}This guard correctly passes through 4. Following from above: assert.strictEqual(
withImageVersion('/images/foo.png', 0),
'/images/foo.png?v=0'
);5. Assets router: cache headers applied inside the try {
const imageData = readFileSync(fullImagePath);
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate');
// ...
sendFile(res, imageData, 'image/png');The headers are set after reading the file. If 6. The second test block (line ~183) only asserts 💡 Suggestions (non-blocking)
SummaryThis is a good fix. The core logic is correct and the test coverage is solid. The main thing worth a follow-up is confirming whether |
This comment has been minimized.
This comment has been minimized.
Normalize report/comparison timestamps in reporter data paths so local image cache-busting does not silently fall back when per-comparison timestamps are missing.\n\nRefine tests to focus on observable outcomes and add edge-case coverage for version=0, existing v params, and cache headers.
This comment has been minimized.
This comment has been minimized.
Apply Biome import/format ordering and update the screenshot image URL memo dependencies to satisfy exhaustive-deps checks.
Vizzly - Visual Test Results
|
Why this change
In TDD mode, baseline/current/diff images are overwritten in place under stable
/images/*URLs.That means the reporter can receive fresh comparison data while the browser still shows stale cached image bytes. The result feels like an SSE issue, but the primary problem is image caching.
What changed
/images/*URLs.comparison.timestamp ?? reportData.timestamp).Test plan
node --test tests/server/routers/assets.test.js tests/reporter/utils/image-url.test.js tests/reporter/utils/report-data.test.jsnpm run build:reporter