Skip to content
TypeScript

perf(web): the code view file reveal hook compiles without manual memoization (#20659)

Julius Marminge99fac2687d43
diff --git a/apps/web/src/components/diffs/useCodeViewFileReveal.ts b/apps/web/src/components/diffs/useCodeViewFileReveal.ts
index b833d02f1b0..a3008229c4c 100644
--- a/apps/web/src/components/diffs/useCodeViewFileReveal.ts
+++ b/apps/web/src/components/diffs/useCodeViewFileReveal.ts
@@ -1,5 +1,5 @@
import type { CodeViewScrollTarget } from "@pierre/diffs";
-import { useCallback, useEffect, useRef, useState } from "react";
+import { useEffect, useRef, useState } from "react";
interface FileRevealHandle {
getInstance(): object | undefined;
@@ -27,5 +27,5 @@ export function useCodeViewFileReveal<TScope>(
handledRequest.current = request;
}, [request, scope, viewer, readyFileKeys]);
- return useCallback((fileKey: string) => setRequest({ fileKey, scope }), [scope]);
+ return (fileKey: string) => setRequest({ fileKey, scope });
}