fix: force reflow avant reset des transitions CSS du crossfade
ci/woodpecker/push/woodpecker Pipeline was successful

Sans forcer un reflow, le browser ignore transition:none et applique
encore l'ancienne transition — causant un bug visuel sur la 1ère frame.
void canvas.offsetWidth flush les styles en attente.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
syoul
2026-03-23 22:05:37 +01:00
parent d7fef466f3
commit a9bf445747
+5 -5
View File
@@ -91,20 +91,20 @@ export function HeatMap({ transactions }: HeatMapProps) {
return; return;
} }
// 1. Hide canvas instantly (no transition)
canvas.style.transition = 'none';
canvas.style.opacity = '0';
// 2. Freeze current frame in the overlay // 2. Freeze current frame in the overlay
try { try {
overlay.src = canvas.toDataURL(); overlay.src = canvas.toDataURL();
} catch { } catch {
// canvas tainted (shouldn't happen with heatmap-only canvas) // canvas tainted (shouldn't happen with heatmap-only canvas)
canvas.style.opacity = '1';
update(); update();
return; return;
} }
// 1. Reset transitions instantly — force reflow to flush any running transition
canvas.style.transition = 'none';
overlay.style.transition = 'none'; overlay.style.transition = 'none';
void canvas.offsetWidth; // force reflow
canvas.style.opacity = '0';
overlay.style.opacity = '1'; overlay.style.opacity = '1';
// 3. Update heatmap (invisible: canvas still at opacity 0) // 3. Update heatmap (invisible: canvas still at opacity 0)