Skip to content
TypeScript

perf(web): the expanded image dialog compiles without manual memoization (#20672)

Julius Marminge92b896710b43
diff --git a/apps/web/src/components/chat/ExpandedImageDialog.tsx b/apps/web/src/components/chat/ExpandedImageDialog.tsx
index 1285b15d358..bc2f3bd564c 100644
--- a/apps/web/src/components/chat/ExpandedImageDialog.tsx
+++ b/apps/web/src/components/chat/ExpandedImageDialog.tsx
@@ -1,12 +1,4 @@
-import {
- memo,
- useCallback,
- useEffect,
- useRef,
- useState,
- type ReactNode,
- type KeyboardEvent,
-} from "react";
+import { memo, useEffect, useRef, useState, type ReactNode, type KeyboardEvent } from "react";
import { ChevronLeftIcon, ChevronRightIcon, XIcon } from "lucide-react";
import { Image as ImageGlyph, Text as TextGlyph } from "lucide";
import { Button } from "../ui/button";
@@ -102,9 +94,9 @@ export const ExpandedImageDialog = memo(function ExpandedImageDialog({
}
: source;
- const navigateImage = useCallback((direction: -1 | 1) => {
+ const navigateImage = (direction: -1 | 1) => {
setImageOffset((current) => current + direction);
- }, []);
+ };
// The element that opened the preview gets focus back on close. Without
// this a close button click leaves focus on the unmounted dialog, and the