Skip to content
TypeScript

perf(web): the zoomable image compiles without manual memoization (#20549)

Julius Marminge687f1e94872e
diff --git a/apps/web/src/components/chat/ZoomableImage.tsx b/apps/web/src/components/chat/ZoomableImage.tsx
index 4ccec372443..466544fb404 100644
--- a/apps/web/src/components/chat/ZoomableImage.tsx
+++ b/apps/web/src/components/chat/ZoomableImage.tsx
@@ -1,12 +1,4 @@
-import {
- useCallback,
- useEffect,
- useImperativeHandle,
- useLayoutEffect,
- useRef,
- useState,
- type Ref,
-} from "react";
+import { useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, type Ref } from "react";
const MAX_ZOOM = 8;
@@ -86,7 +78,7 @@ export function ZoomableImage({
[],
);
- const changeZoom = useCallback((next: number, point?: { x: number; y: number }) => {
+ const changeZoom = (next: number, point?: { x: number; y: number }) => {
const viewport = viewportRef.current;
const previous = zoomRef.current;
const clamped = Math.min(MAX_ZOOM, Math.max(1, next));
@@ -102,7 +94,7 @@ export function ZoomableImage({
};
zoomRef.current = clamped;
setZoom(clamped);
- }, []);
+ };
useLayoutEffect(() => {
const viewport = viewportRef.current;