@devries-cameron20 / t3code-1 / commits / c5310c2617
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

perf(web): the HTML document frame compiles without manual memoization (#20676)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 16, 2026 at 21:54 UTC c5310c26171024e5c1e671d1c33ea092f986b9ca
1 file changed +21 -23
apps/web/src/components/files/BrowserDocumentFrame.tsx
+21 -23
@@ -22,7 +22,7 @@ import {
22 matchesKeybindingShortcut,
23 normalizeEventKey,
24 } from "@t3tools/shared/keybindings";
25 -import { useEffect, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
25 +import { useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from "react";
26
27 import { useOpenLink } from "~/browser/useOpenLink";
28 import { ExpandedImageDialog } from "~/components/chat/ExpandedImageDialog";
@@ -135,29 +135,27 @@ export function HtmlRenderDocument(props: {
135 // binding counts whatever its `when`, and a key that any binding gives to
136 // another command stays with the page. Only Cmd/Ctrl chords: a printable key
137 // would type into the composer instead.
138 - const { shortcuts, blocked } = useMemo(() => {
139 - const mac = isMacPlatform(navigator.platform);
140 - const resolve = (shortcut: KeybindingShortcut): HtmlRenderShortcut => ({
141 - key: shortcut.key,
142 - metaKey: shortcut.metaKey || (shortcut.modKey && mac),
143 - ctrlKey: shortcut.ctrlKey || (shortcut.modKey && !mac),
144 - shiftKey: shortcut.shiftKey,
145 - altKey: shortcut.altKey,
146 - });
147 - const blocked = [...keybindings, ...(environmentKeybindings ?? [])]
148 - .filter((binding) => !HTML_RENDER_SHORTCUT_COMMANDS.has(binding.command))
149 - .map((binding) => resolve(binding.shortcut));
150 - const shortcuts = new Map<string, HtmlRenderShortcut>();
151 - for (const { command, shortcut } of keybindings) {
152 - if (
153 - HTML_RENDER_SHORTCUT_COMMANDS.has(command) &&
154 - (shortcut.metaKey || shortcut.ctrlKey || shortcut.modKey)
155 - ) {
156 - shortcuts.set(shortcutConflictKey(shortcut), resolve(shortcut));
157 - }
138 + const mac = isMacPlatform(navigator.platform);
139 + const resolve = (shortcut: KeybindingShortcut): HtmlRenderShortcut => ({
140 + key: shortcut.key,
141 + metaKey: shortcut.metaKey || (shortcut.modKey && mac),
142 + ctrlKey: shortcut.ctrlKey || (shortcut.modKey && !mac),
143 + shiftKey: shortcut.shiftKey,
144 + altKey: shortcut.altKey,
145 + });
146 + const blocked = [...keybindings, ...(environmentKeybindings ?? [])]
147 + .filter((binding) => !HTML_RENDER_SHORTCUT_COMMANDS.has(binding.command))
148 + .map((binding) => resolve(binding.shortcut));
149 + const shortcutsByKey = new Map<string, HtmlRenderShortcut>();
150 + for (const { command, shortcut } of keybindings) {
151 + if (
152 + HTML_RENDER_SHORTCUT_COMMANDS.has(command) &&
153 + (shortcut.metaKey || shortcut.ctrlKey || shortcut.modKey)
154 + ) {
155 + shortcutsByKey.set(shortcutConflictKey(shortcut), resolve(shortcut));
156 }
159 - return { shortcuts: [...shortcuts.values()], blocked };
160 - }, [environmentKeybindings, keybindings]);
157 + }
158 + const shortcuts = [...shortcutsByKey.values()];
159 const postShortcuts = () => {
160 frameRef.current?.contentWindow?.postMessage(
161 htmlRenderShortcutsMessage(shortcuts, blocked),