fix(app): stabilize canvas refresh and borders

Fast Refresh preserves refs while rerunning effects, so canceled paint requests must release their retained IDs or unseen diff regions stop rendering. Paint the final expanded body’s reserved boundary pixel because no following header owns that seam.
This commit is contained in:
Mohamed Boudra
2026-08-17 21:14:38 +02:00
parent 8f7b3e8d75
commit 9e6e148ba2
5 changed files with 90 additions and 14 deletions
@@ -1,5 +1,10 @@
import { selectionRectangles } from "./hit-testing";
import { fragmentWidthForRange, visibleRowRange } from "./model";
import {
DIFF_BODY_BORDER_HEIGHT,
finalExpandedBodyBorderTop,
fragmentWidthForRange,
visibleRowRange,
} from "./model";
import { codeLineNumberTone, codeTextColor } from "./palette";
import { reviewBackgroundPaint, reviewDividerHeight, reviewGapTop } from "./review-paint";
import type {
@@ -64,6 +69,17 @@ export function paintWebViewport(input: PaintWebViewportInput): void {
});
}
const finalBorderTop = finalExpandedBodyBorderTop(input.model);
if (finalBorderTop !== null) {
context.fillStyle = input.palette.border;
context.fillRect(
0,
finalBorderTop - input.scrollTop,
input.viewportWidth,
DIFF_BODY_BORDER_HEIGHT,
);
}
if (input.selection) paintSelection(input, input.selection);
context.restore();
}