The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 21:30 UTC
Reduce ChatMarkdown settings rerenders (#3536)
Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
cursor[bot] committed
Jun 23, 2026 at 11:47 UTC
c6c64918f8c582cc8b12de155d6c9aae12037147
1 file changed
+7
-3
apps/web/src/components/ChatMarkdown.tsx
+7
-3
@@ -54,7 +54,7 @@ import { resolveDiffThemeName, type DiffThemeName } from "../lib/diffRendering";
54
import { fnv1a32 } from "../lib/diffRendering";
55
import { LRUCache } from "../lib/lruCache";
56
import { useTheme } from "../hooks/useTheme";
57
-import { useClientSettings } from "../hooks/useSettings";
57
+import { getClientSettings } from "../hooks/useSettings";
58
import {
59
chatMarkdownClipboardPayload,
60
serializeTableElementToCsv,
@@ -293,10 +293,14 @@ function getHighlighterPromise(language: string): Promise<DiffsHighlighter> {
293
return promise;
294
}
295
296
+function readInitialWordWrapSetting(): boolean {
297
+ return getClientSettings().wordWrap;
298
+}
299
+
300
function MarkdownTable({ children, ...props }: React.ComponentProps<"table">) {
301
const containerRef = useRef<HTMLDivElement | null>(null);
302
const tableRef = useRef<HTMLTableElement | null>(null);
299
- const [expanded, setExpanded] = useState(useClientSettings((settings) => settings.wordWrap));
303
+ const [expanded, setExpanded] = useState(readInitialWordWrapSetting);
304
const [copied, setCopied] = useState(false);
305
const copiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
306
const expandLabel = expanded ? "Collapse table cells" : "Expand table cells";
@@ -526,7 +530,7 @@ function MarkdownCodeBlock({
530
children: ReactNode;
531
}) {
532
const [copied, setCopied] = useState(false);
529
- const [wrapped, setWrapped] = useState(useClientSettings((settings) => settings.wordWrap));
533
+ const [wrapped, setWrapped] = useState(readInitialWordWrapSetting);
534
const copiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
535
const wrapLabel = wrapped ? "Disable line wrap" : "Wrap lines";
536
const copyLabel = copied ? "Copied" : "Copy code";