Skip to content

Commit a6f1a60

Browse files
committed
Update @pierre/diffs.
1 parent 4f5ea51 commit a6f1a60

4 files changed

Lines changed: 34 additions & 6 deletions

File tree

core/App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ import type {
142142
const emptyWalkthroughNotes = new Map<string, WalkthroughNote>();
143143
const emptyFiles: ReadonlyArray<ChangedFile> = [];
144144
const walkthroughCodeViewBottomInset = 96;
145+
const disableCodeViewWorkerPool = process.env.NODE_ENV === 'test';
145146
type MainMode = 'review' | 'commit';
146147
const CODE_FONT_SIZE_DEFAULT = 13;
147148
const CODE_FONT_SIZE_MAX = 32;
@@ -2587,6 +2588,7 @@ export default function App() {
25872588
blocks={blocks}
25882589
bottomInset={walkthroughCodeViewBottomInset}
25892590
commitMetadata={null}
2591+
disableWorkerPool={disableCodeViewWorkerPool}
25902592
files={[]}
25912593
forceExpandedPaths={diffSearchMatchPathSet}
25922594
onActiveBlockChange={onActiveBlockChange}
@@ -2811,6 +2813,7 @@ export default function App() {
28112813
) : (
28122814
<ReviewCodeView
28132815
{...commonReviewProps}
2816+
disableWorkerPool={disableCodeViewWorkerPool}
28142817
files={visibleFiles}
28152818
forceExpandedPaths={diffSearchMatchPathSet}
28162819
scrollTarget={scrollTarget}

core/__tests__/setup.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,31 @@ if (typeof HTMLElement !== 'undefined' && !HTMLElement.prototype.scrollTo) {
3232
HTMLElement.prototype.scrollTo = scrollTo;
3333
}
3434

35+
if (typeof HTMLElement !== 'undefined') {
36+
const getBoundingClientRect = HTMLElement.prototype.getBoundingClientRect;
37+
HTMLElement.prototype.getBoundingClientRect = function getTestBoundingClientRect() {
38+
const rect = getBoundingClientRect.call(this);
39+
40+
if (rect.height === 0 && this.classList.contains('code-view')) {
41+
return new DOMRect(rect.x, rect.y, rect.width || 1024, 768);
42+
}
43+
44+
return rect;
45+
};
46+
}
47+
48+
if (typeof ResizeObserver === 'undefined') {
49+
globalThis.ResizeObserver = class ResizeObserver {
50+
constructor(_callback: ResizeObserverCallback) {}
51+
52+
disconnect() {}
53+
54+
observe() {}
55+
56+
unobserve() {}
57+
};
58+
}
59+
3560
if (typeof Range !== 'undefined') {
3661
Range.prototype.getBoundingClientRect ??= () => new DOMRect();
3762
Range.prototype.getClientRects ??= () => [] as unknown as DOMRectList;

core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@nkzw/mdx-editor": "^0.2.1",
1818
"@nkzw/use-relative-time": "^1.2.3",
1919
"@phosphor-icons/react": "^2.1.10",
20-
"@pierre/diffs": "1.2.12",
20+
"@pierre/diffs": "1.3.0-beta.7",
2121
"@pierre/trees": "1.0.0-beta.5",
2222
"ghostty-web": "^0.4.0",
2323
"lucide-react": "^1.23.0"

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)