From 96c6d5923787148bec7e4d2e3cbef9a543dc0d19 Mon Sep 17 00:00:00 2001 From: Mihkel Eidast Date: Fri, 2 Apr 2021 15:50:06 +0300 Subject: [PATCH 1/2] skip file system and components parsing when component template is changed --- packages/core/src/mixins/source.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/core/src/mixins/source.js b/packages/core/src/mixins/source.js index 1dcea7a93..7f806f62f 100644 --- a/packages/core/src/mixins/source.js +++ b/packages/core/src/mixins/source.js @@ -135,11 +135,19 @@ module.exports = mixin( this.emit('changed', data); this._app.emit('source:changed', this, data); - this.refresh().then((source) => { - this.emit('updated', data); - this._app.emit('source:updated', this, data); - return source; - }); + if (event === 'change' && data.isTemplate) { + // re-resolve context in case the changed template is used as fully rendered component in context + this._resolveTreeContext(this._fileTree).then(() => { + this.emit('updated', data); + this._app.emit('source:updated', this, data); + }); + } else { + this.refresh().then((source) => { + this.emit('updated', data); + this._app.emit('source:updated', this, data); + return source; + }); + } }); }); } From 055055ea6dbe7b6e618fcff57c762fec1052718b Mon Sep 17 00:00:00 2001 From: Mihkel Eidast Date: Fri, 2 Apr 2021 16:17:20 +0300 Subject: [PATCH 2/2] skip parsing completely when resource is changed --- packages/core/src/mixins/source.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/src/mixins/source.js b/packages/core/src/mixins/source.js index 7f806f62f..220ba08b3 100644 --- a/packages/core/src/mixins/source.js +++ b/packages/core/src/mixins/source.js @@ -135,7 +135,10 @@ module.exports = mixin( this.emit('changed', data); this._app.emit('source:changed', this, data); - if (event === 'change' && data.isTemplate) { + if (event === 'change' && data.isResource) { + this.emit('updated', data); + this._app.emit('source:updated', this, data); + } else if (event === 'change' && data.isTemplate) { // re-resolve context in case the changed template is used as fully rendered component in context this._resolveTreeContext(this._fileTree).then(() => { this.emit('updated', data);