最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

text editor - Memorize Svelte Components Across Parents - Stack Overflow

programmeradmin0浏览0评论

I'm implementing a view layer for a markdown editor in svelte 5.

I've already created an incremental parser that parses markdown to MDAst.

MDAst parse a markdown source file as a hierarchy of sections.

<section>
  <h1>Some Heading</h1>
  <p>A huge paragraph</p>
  <p>Another huge paragraph</p>
</section>

Therefore, when I insert a header, it will split the current section into two sections. In this case, it seems like svelte will remove some children and re-create these children into the newly created section. These components are sometimes large, and these edits cause can visible stucks in rendering.

<section>
  <h1>Some Heading</h1>
  <p>A huge paragraph</p>
</section>
<section>
  <h1>Another Heading</h1>
  <p>Another huge paragraph</p>
</section>

My question is, if I want to cache these children elements across rendering life cycles, what should I do?

发布评论

评论列表(0)

  1. 暂无评论