fix: mutate polyline points in place on SSE ping, no fetch, no flicker

This commit is contained in:
M1
2026-03-17 07:44:09 +04:00
parent 2c32bc1115
commit 017d489e2e
2 changed files with 27 additions and 19 deletions
+1 -1
View File
@@ -9,5 +9,5 @@ export function sparkline(values: number[], width = 120, height = 32): string {
const y = height - ((v - min) / range) * (height - 4) - 2;
return `${x},${y}`;
}).join(' ');
return `<svg width="${width}" height="${height}" class="inline-block"><polyline points="${points}" fill="none" stroke="#60a5fa" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
return `<svg width="${width}" height="${height}" class="inline-block" data-vals="${values.join(',')}"><polyline points="${points}" fill="none" stroke="#60a5fa" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
}