The best way to control Claude Code, Codex and more from any computer or phone
perf(web): the HTML render frame compiles without manual memoization (#20688)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 21:49 UTC
4539e774685452e885879a9b84e0fb0339e1cff6
1 file changed
+11
-14
apps/web/src/components/chat/HtmlRenderFrame.tsx
+11
-14
@@ -8,7 +8,7 @@ import {
8
type HtmlRenderReference,
9
} from "@t3tools/shared/htmlRender";
10
import { Maximize2Icon } from "lucide-react";
11
-import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
11
+import { useEffect, useLayoutEffect, useRef, useState } from "react";
12
13
import { useAssetUrlRefresh, useAssetUrlState } from "~/assets/assetUrls";
14
import { cn } from "~/lib/utils";
@@ -45,16 +45,13 @@ export function HtmlRenderFrame(props: {
45
const [contentHeight, setContentHeight] = useState<number>();
46
const height = htmlRenderFrameHeight(props.htmlRender, width, contentHeight);
47
const fileName = htmlRenderFileName(title);
48
- const resource = useMemo(
49
- () => ({
50
- _tag: "attachment" as const,
51
- attachmentId,
52
- fileName,
53
- mimeType: "text/html",
54
- disposition: "inline" as const,
55
- }),
56
- [attachmentId, fileName],
57
- );
48
+ const resource = {
49
+ _tag: "attachment" as const,
50
+ attachmentId,
51
+ fileName,
52
+ mimeType: "text/html",
53
+ disposition: "inline" as const,
54
+ };
55
// A cached URL with life left is reused, so the browser's cache serves the
56
// page again; one near expiry is minted afresh, since a frame cannot report a
57
// failed load.
@@ -62,11 +59,11 @@ export function HtmlRenderFrame(props: {
59
const srcExpiresAt = useRef(0);
60
const [expandedSrc, setExpandedSrc] = useState<string | null>(null);
61
const [ready, setReady] = useState(false);
65
- const showPage = useCallback(() => setReady(true), []);
66
- const fitPage = useCallback((contentHeight: number) => {
62
+ const showPage = () => setReady(true);
63
+ const fitPage = (contentHeight: number) => {
64
setContentHeight(contentHeight);
65
setReady(true);
69
- }, []);
66
+ };
67
const { onFullscreenChange } = props;
68
useEffect(() => {
69
if (expandedSrc === null) return;