Skip to content

Commit a7ee16d

Browse files
perf(web): the guide file diff compiles without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a702563 commit a7ee16d

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

‎apps/web/src/components/pullRequest/guide/GuideFileDiff.tsx‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
type FileDiffMetadata,
55
} from "@pierre/diffs";
66
import { FileDiff } from "@pierre/diffs/react";
7-
import { useMemo } from "react";
87

98
import { useTheme } from "~/hooks/useTheme";
109
import { resolveDiffThemeName } from "~/lib/diffRendering";
@@ -22,21 +21,18 @@ export function GuideFileDiff({
2221
const { resolvedTheme } = useTheme();
2322
// Loading the unchanged lines rewrites the diff it is given; the excerpts read the same file
2423
// as a patch, so this view expands a copy of its own.
25-
const expandable = useMemo(() => cloneFileDiffMetadata(file), [file]);
26-
const options = useMemo(
27-
() => ({
28-
diffStyle: "unified" as const,
29-
lineDiffType: "none" as const,
30-
overflow: "scroll" as const,
31-
disableFileHeader: true,
32-
theme: resolveDiffThemeName(resolvedTheme),
33-
themeType: resolvedTheme,
34-
preferredHighlighter: PREFERRED_HIGHLIGHTER,
35-
unsafeCSS: DIFF_VIEW_UNSAFE_CSS,
36-
loadDiffFiles,
37-
}),
38-
[loadDiffFiles, resolvedTheme],
39-
);
24+
const expandable = cloneFileDiffMetadata(file);
25+
const options = {
26+
diffStyle: "unified" as const,
27+
lineDiffType: "none" as const,
28+
overflow: "scroll" as const,
29+
disableFileHeader: true,
30+
theme: resolveDiffThemeName(resolvedTheme),
31+
themeType: resolvedTheme,
32+
preferredHighlighter: PREFERRED_HIGHLIGHTER,
33+
unsafeCSS: DIFF_VIEW_UNSAFE_CSS,
34+
loadDiffFiles,
35+
};
4036
return (
4137
<div className="border-t border-border/60">
4238
<FileDiff fileDiff={expandable} options={options} />

0 commit comments

Comments
 (0)