diff options
| author | Shoubhit Dash <[email protected]> | 2026-03-06 18:19:15 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-06 06:49:15 -0600 |
| commit | 1d9dcd2a27736b83d20abc0111141fdd6bffde7e (patch) | |
| tree | 70d40994ed50d7f068c1415a67d9d8782d78d9af /packages/ui/src/components | |
| parent | eeeb21ff8638eddd960afbd8f522c87d850d6183 (diff) | |
| download | opencode-1d9dcd2a27736b83d20abc0111141fdd6bffde7e.tar.gz opencode-1d9dcd2a27736b83d20abc0111141fdd6bffde7e.zip | |
share: speed up share loads (#16165)
Diffstat (limited to 'packages/ui/src/components')
| -rw-r--r-- | packages/ui/src/components/markdown.tsx | 17 | ||||
| -rw-r--r-- | packages/ui/src/components/session-review.tsx | 2 |
2 files changed, 16 insertions, 3 deletions
diff --git a/packages/ui/src/components/markdown.tsx b/packages/ui/src/components/markdown.tsx index bb41c74ef..01254f118 100644 --- a/packages/ui/src/components/markdown.tsx +++ b/packages/ui/src/components/markdown.tsx @@ -44,6 +44,19 @@ function sanitize(html: string) { return DOMPurify.sanitize(html, config) } +function escape(text: string) { + return text + .replace(/&/g, "&") + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/\"/g, """) + .replace(/'/g, "'") +} + +function fallback(markdown: string) { + return escape(markdown).replace(/\r\n?/g, "\n").replace(/\n/g, "<br>") +} + type CopyLabels = { copy: string copied: string @@ -237,7 +250,7 @@ export function Markdown( const [html] = createResource( () => local.text, async (markdown) => { - if (isServer) return "" + if (isServer) return fallback(markdown) const hash = checksum(markdown) const key = local.cacheKey ?? hash @@ -255,7 +268,7 @@ export function Markdown( if (key && hash) touch(key, { hash, html: safe }) return safe }, - { initialValue: "" }, + { initialValue: isServer ? fallback(local.text) : "" }, ) let copySetupTimer: ReturnType<typeof setTimeout> | undefined diff --git a/packages/ui/src/components/session-review.tsx b/packages/ui/src/components/session-review.tsx index ad9e5b2c3..25a646ace 100644 --- a/packages/ui/src/components/session-review.tsx +++ b/packages/ui/src/components/session-review.tsx @@ -145,7 +145,7 @@ export const SessionReview = (props: SessionReviewProps) => { const searchHandles = new Map<string, FileSearchHandle>() const readyFiles = new Set<string>() const [store, setStore] = createStore<{ open: string[]; force: Record<string, boolean> }>({ - open: props.diffs.length > 10 ? [] : props.diffs.map((d) => d.file), + open: [], force: {}, }) |
