Skip to content

Commit 7fa7492

Browse files
kubeclaude
andcommitted
Fix restart revision bump and separator DPR scaling
Two small correctness fixes from PR review: - When the simulation restarts (totalFrames drops), bump the revision counter immediately so React re-renders to pick up the empty store. Previously the bump only happened when subsequent fetched frames were pushed, so a cancelled/empty follow-up fetch left the chart displaying stale pre-restart data. - In the drawClear hook, scale the separator line's width and its sub-pixel offset by devicePixelRatio. uPlot's canvas uses physical pixels, so the previous hardcoded 1/0.5 values rendered at 0.5/0.25 CSS pixels on HiDPI displays — thinner than uPlot's own grid lines. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 05d278e commit 7fa7492

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

libs/@hashintel/petrinaut/src/views/Editor/panels/BottomPanel/subviews/simulation-timeline.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ function useStreamingData(): {
222222
if (totalFrames < processedRef.current) {
223223
storeRef.current = createEmptyStore(store.places);
224224
processedRef.current = 0;
225+
setRevision((r) => r + 1);
225226
}
226227

227228
const startIndex = processedRef.current;
@@ -680,12 +681,13 @@ function buildUPlotOptions(opts: ChartOptions): uPlot.Options {
680681
(u) => {
681682
const { ctx } = u;
682683
const { left: bx, width: bw, top: by } = u.bbox;
684+
const dpr = devicePixelRatio;
683685
ctx.save();
684686
ctx.strokeStyle = "#cbd5e1";
685-
ctx.lineWidth = 1;
687+
ctx.lineWidth = dpr;
686688
ctx.beginPath();
687-
ctx.moveTo(bx, by - 0.5);
688-
ctx.lineTo(bx + bw, by - 0.5);
689+
ctx.moveTo(bx, by - 0.5 * dpr);
690+
ctx.lineTo(bx + bw, by - 0.5 * dpr);
689691
ctx.stroke();
690692
ctx.restore();
691693
},

0 commit comments

Comments
 (0)