LearnNewsExamplesServices
Frontmatter
id8080
titleLivePreview: Reuse Markdown component reference to avoid re-creation
stateClosed
labels
enhancementai
assigneestobiu
createdAtDec 10, 2025, 3:07 PM
updatedAtDec 10, 2025, 3:30 PM
githubUrlhttps://github.com/neomjs/neo/issues/8080
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 10, 2025, 3:30 PM

LivePreview: Reuse Markdown component reference to avoid re-creation

Closed v11.17.0 enhancementai
tobiu
tobiu commented on Dec 10, 2025, 3:07 PM

In src/code/LivePreview.mjs, update doRunSource to reuse the existing Neo.component.Markdown instance if it exists and is valid.

Logic:

  • Store the reference returned by container.add() in me.markdownComponent.
  • In doRunSource, if me.markdownComponent exists and is not destroyed, update its value.
  • Otherwise, proceed with container.removeAll() and container.add(), storing the new reference.

This prevents the component from being destroyed/recreated on every keystroke, avoiding unnecessary parent VDOM updates and race conditions.

tobiu added the enhancement label on Dec 10, 2025, 3:07 PM
tobiu added the ai label on Dec 10, 2025, 3:07 PM
tobiu assigned to @tobiu on Dec 10, 2025, 3:08 PM
tobiu referenced in commit 768af2a - "LivePreview: Reuse Markdown component reference to avoid re-creation #8080" on Dec 10, 2025, 3:29 PM
tobiu closed this issue on Dec 10, 2025, 3:30 PM