Skip to content

Commit 4020dd5

Browse files
committed
Optimize LivePreview and NeoExecutor container updates by merging remove and add #8084
1 parent c669b81 commit 4020dd5

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/code/LivePreview.mjs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,9 @@ class LivePreview extends Container {
358358
if (me.markdownComponent && !me.markdownComponent.isDestroyed) {
359359
me.markdownComponent.value = source
360360
} else {
361-
container.removeAll();
361+
// destroy, silent => merge changes into one update cycle
362+
container.removeAll(true, true);
363+
362364
me.markdownComponent = container.add({
363365
module : me.markdownComponentClass,
364366
style : {height: '100%', overflow: 'auto'},
@@ -476,11 +478,6 @@ class LivePreview extends Container {
476478
me.fire('editorChange', {value});
477479

478480
me.doRunSource()
479-
480-
// We are not using getPreviewContainer(), since we only want to update the LivePreview in case it is visible.
481-
/*if (me.previewContainer) {
482-
me.doRunSource()
483-
}*/
484481
}
485482

486483
/**

src/code/executor/Neo.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ class NeoExecutor extends Base {
173173
'})'
174174
].join('\n');
175175

176-
container.removeAll();
176+
// destroy, silent => merge changes into one update cycle
177+
container.removeAll(true, true);
177178

178179
// We must ensure that classes inside the editor won't get cached, since this disables run-time changes
179180
// See: https://github.com/neomjs/neo/issues/5863

0 commit comments

Comments
 (0)