Skip to content

Commit 728332c

Browse files
committed
chore(deps): bump streamdown to 2.7.1
Streamdown 2.6+ hands streaming placeholders (streamdown:incomplete-link, streamdown:incomplete-image) to custom components instead of stripping them, so the mothership chat link and image renderers now withhold those until the URL completes.
1 parent d7f3158 commit 728332c

4 files changed

Lines changed: 22 additions & 17 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ function SourceReference({ index, children }: SourceReferenceProps) {
189189
)
190190
}
191191

192+
/**
193+
* Placeholder URLs Streamdown's streaming parser substitutes for a link or image
194+
* whose URL is still arriving. Neither resolves, so a pending link renders as
195+
* its text and a pending image is withheld until the URL completes.
196+
*/
197+
const INCOMPLETE_LINK_HREF = 'streamdown:incomplete-link'
198+
const INCOMPLETE_IMAGE_SRC = 'streamdown:incomplete-image'
199+
192200
const WORKSPACE_LINK_PREFIX = '#sim-workspace-ref-'
193201
const WorkspaceRefsContext = createContext<{
194202
resources: WorkspaceResourceTagData[]
@@ -375,6 +383,7 @@ const MARKDOWN_COMPONENTS = {
375383
href?: string
376384
'data-footnote-ref'?: boolean
377385
}) {
386+
if (href === INCOMPLETE_LINK_HREF) return <>{children}</>
378387
if (href?.startsWith(SOURCE_LINK_PREFIX)) {
379388
return (
380389
<SourceReference index={Number(href.slice(SOURCE_LINK_PREFIX.length))}>
@@ -488,7 +497,7 @@ const MARKDOWN_COMPONENTS = {
488497
return <del className='text-[var(--text-tertiary)] line-through'>{children}</del>
489498
},
490499
img({ src, alt }: ComponentPropsWithoutRef<'img'>) {
491-
if (typeof src !== 'string' || !src) return null
500+
if (typeof src !== 'string' || !src || src === INCOMPLETE_IMAGE_SRC) return null
492501
return (
493502
<Lightbox src={src} alt={alt ?? ''}>
494503
<button
@@ -606,14 +615,12 @@ function ChatContentInner({
606615
* trades identical pixels, unlike flipping at `isRevealing`'s edge, which cut
607616
* running fades short (the old completion flash).
608617
*
609-
* The swap must REMOUNT Streamdown (via `key`), not just flip its props:
610-
* Streamdown's default element components are memoized on className + source
611-
* position (`E`/`qe` in streamdown 2.5), so a re-parse of unchanged content
612-
* without the animate plugin bails at every unoverridden element (`p`,
613-
* `strong`, `tr`, headings, …) and leaves the stale per-char span DOM in
614-
* place. The settled instance keeps the streaming parser (`parserTree`
615-
* below) so the remount only sheds the spans, never re-interprets the
616-
* markdown.
618+
* The swap REMOUNTS Streamdown (via `key`) rather than flipping its props,
619+
* so the settled tree is built from scratch without the animate plugin and
620+
* no memoized element (`p`, `strong`, `tr`, headings, …) can carry the
621+
* per-word span DOM over. The settled instance keeps the streaming parser
622+
* (`parserTree` below) so the remount only sheds the spans, never
623+
* re-interprets the markdown.
617624
*
618625
* The drain is deliberately one-way: a stream that resumes afterwards
619626
* (reconnect/continuation) reveals paced but unfaded, because re-arming

‎apps/sim/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
"sim": "workspace:*",
282282
"socket.io-client": "4.8.4",
283283
"ssh2": "^1.17.0",
284-
"streamdown": "2.5.0",
284+
"streamdown": "2.7.1",
285285
"stripe": "18.5.0",
286286
"tldts": "7.4.19",
287287
"twilio": "6.2.0",

‎bun.lock‎

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/workflow-renderer/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"react-dom": "19.2.4",
7676
"remark-breaks": "^4.0.0",
7777
"remark-gfm": "^4.0.1",
78-
"streamdown": "2.5.0",
78+
"streamdown": "2.7.1",
7979
"typescript": "^7.0.2",
8080
"vitest": "^5.1.0"
8181
}

0 commit comments

Comments
 (0)