Skip to content

Commit 1eff140

Browse files
perf(web): the zoomable image compiles without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 7111501 commit 1eff140

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

‎apps/web/reactCompiledFiles.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,5 @@ export const REACT_COMPILED_FILES = [
9696
"apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx",
9797
"apps/web/src/components/ThreadTerminalDrawer.tsx",
9898
"apps/web/src/components/settings/SettingsPanels.tsx",
99+
"apps/web/src/components/chat/ZoomableImage.tsx",
99100
] as const;

‎apps/web/src/components/chat/ZoomableImage.tsx‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
import {
2-
useCallback,
3-
useEffect,
4-
useImperativeHandle,
5-
useLayoutEffect,
6-
useRef,
7-
useState,
8-
type Ref,
9-
} from "react";
1+
import { useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, type Ref } from "react";
102

113
const MAX_ZOOM = 8;
124

@@ -86,7 +78,7 @@ export function ZoomableImage({
8678
[],
8779
);
8880

89-
const changeZoom = useCallback((next: number, point?: { x: number; y: number }) => {
81+
const changeZoom = (next: number, point?: { x: number; y: number }) => {
9082
const viewport = viewportRef.current;
9183
const previous = zoomRef.current;
9284
const clamped = Math.min(MAX_ZOOM, Math.max(1, next));
@@ -102,7 +94,7 @@ export function ZoomableImage({
10294
};
10395
zoomRef.current = clamped;
10496
setZoom(clamped);
105-
}, []);
97+
};
10698

10799
useLayoutEffect(() => {
108100
const viewport = viewportRef.current;

0 commit comments

Comments
 (0)