perf: skip file system and components parsing when template/resource is changed #949
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Found a small but definite improvement for #843.
The component templates are cached by adapters/engines. Doing a full re-parse of file system and components tree is not necessary when an existing template is only changing. It's currently still necessary when a component template is added/removed since that needs to modify the components tree so the UI would update accordingly.
The context still needs to be re-resolved, in case the changed template has been used as fully rendered component in some other component's context. This is quite unfortunate, since resolving the context takes up a lot of time and might not even be used in some projects - for example, React projects with client-side hydrating are probably not using this feature because it's near impossible to know what to hydrate if it's rendered from context. So maybe we should additionally add a config flag to disable that feature if there is no need for it?
Additionally, I added a complete bypass of the parsing/resolving when a component resource is changed (think .spec.js test files or .css files that live in the component directory) since they are cached by nothing and do not modify the component/context at all.