solid-markdown icon indicating copy to clipboard operation
solid-markdown copied to clipboard

When providing a streaming content, everything re-renders all the time

Open baptisteArno opened this issue 2 years ago • 0 comments

One thing that is cool with react-markdown is that even if you provide a content that is being streamed, what was already added to the DOM won't re-rendered again, allowing the user to interact with the existing text while the content is being streamed.

It seems this does not work the same with solid-markdown.

Reproduction:

export const StreamingBubble = (props: Props) => {
  const [content, setContent] = createSignal<string>('')

  onMount(() => {
    setInterval(() => {
      setContent(content => content + 'new content')
    }, 100)
  })

  return <SolidMarkdown children={content()} />
}

If you select the text, whenever the component re-renders, the selection will be removed.

baptisteArno avatar Apr 10 '24 12:04 baptisteArno