Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: skip file system and components parsing when template/resource is changed #949

Merged
merged 4 commits into from
May 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions packages/core/src/mixins/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,22 @@ module.exports = mixin(
this.emit('changed', data);
this._app.emit('source:changed', this, data);

this.refresh().then((source) => {
if (event === 'change' && data.isResource) {
this.emit('updated', data);
this._app.emit('source:updated', this, data);
return source;
});
} 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);
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;
});
}
});
});
}
Expand Down