| ... | ... | @@ -54,7 +54,7 @@ import { resolveDiffThemeName, type DiffThemeName } from "../lib/diffRendering"; |
| 54 | 54 | import { fnv1a32 } from "../lib/diffRendering"; |
| 55 | 55 | import { LRUCache } from "../lib/lruCache"; |
| 56 | 56 | import { useTheme } from "../hooks/useTheme"; |
| 57 | | import { useClientSettings } from "../hooks/useSettings"; |
| 57 | import { getClientSettings } from "../hooks/useSettings"; |
| 58 | 58 | import { |
| 59 | 59 | chatMarkdownClipboardPayload, |
| 60 | 60 | serializeTableElementToCsv, |
| ... | ... | @@ -293,10 +293,14 @@ function getHighlighterPromise(language: string): Promise<DiffsHighlighter> { |
| 293 | 293 | return promise; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | function readInitialWordWrapSetting(): boolean { |
| 297 | return getClientSettings().wordWrap; |
| 298 | } |
| 299 | |
| 296 | 300 | function MarkdownTable({ children, ...props }: React.ComponentProps<"table">) { |
| 297 | 301 | const containerRef = useRef<HTMLDivElement | null>(null); |
| 298 | 302 | const tableRef = useRef<HTMLTableElement | null>(null); |
| 299 | | const [expanded, setExpanded] = useState(useClientSettings((settings) => settings.wordWrap)); |
| 303 | const [expanded, setExpanded] = useState(readInitialWordWrapSetting); |
| 300 | 304 | const [copied, setCopied] = useState(false); |
| 301 | 305 | const copiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null); |
| 302 | 306 | const expandLabel = expanded ? "Collapse table cells" : "Expand table cells"; |
| ... | ... | @@ -526,7 +530,7 @@ function MarkdownCodeBlock({ |
| 526 | 530 | children: ReactNode; |
| 527 | 531 | }) { |
| 528 | 532 | const [copied, setCopied] = useState(false); |
| 529 | | const [wrapped, setWrapped] = useState(useClientSettings((settings) => settings.wordWrap)); |
| 533 | const [wrapped, setWrapped] = useState(readInitialWordWrapSetting); |
| 530 | 534 | const copiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null); |
| 531 | 535 | const wrapLabel = wrapped ? "Disable line wrap" : "Wrap lines"; |
| 532 | 536 | const copyLabel = copied ? "Copied" : "Copy code"; |