@devries-cameron20 / t3code Mirror · read-only / commits / ff045198dc
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 18:30 UTC

fix(web): PDF preview prerenders pages two viewports below the visible area (#35666)

Julius Marminge committed Nov 12, 2026 at 15:03 UTC ff045198dcea081ede43683d4e20e7fdbffa79b3
2 files changed +3 -1
apps/web/src/components/files/pdfLayout.test.ts
+2
@@ -67,6 +67,8 @@ describe("mixed-height page layout", () => {
67 expect(indexes(0, 100)).toEqual([0, 1]);
68 expect(indexes(1100, 100)).toEqual([2]);
69 expect(indexes(1100, 900)).toEqual([1, 2]);
70 + // Page 2 starts 180px (1.8 viewports) below the visible bottom of 800.
71 + expect(indexes(700, 100)).toEqual([1, 2]);
72 expect(visiblePdfPages(ratios, offsets, 0, 100)[0]).toEqual({ index: 0, ratio: ratios[0] });
73 });
74
apps/web/src/components/files/pdfLayout.ts
+1 -1
@@ -40,7 +40,7 @@ export function visiblePdfPages(
40 ) {
41 return ratios.flatMap((ratio, index) =>
42 offsets[index + 1]! >= scrollTop - viewportHeight &&
43 - offsets[index]! <= scrollTop + viewportHeight * 2
43 + offsets[index]! <= scrollTop + viewportHeight * 3
44 ? [{ index, ratio }]
45 : [],
46 );