refactor: optimize ajv load order #1607
Merged
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.
Types
Background or solution
ajv 在初始化和 compile 的时候会花费很长的时间,大概 80~100ms,可以通过延迟加载,在界面出现后,按需进行处理。
优化 menu 在启动逻辑中的引入顺序,避免过早的引入 menu -> keybinding -> monaco-editor 逻辑。这里可以看到引入 tab-bar-toolbar.js 后,会引入 menu 导致后面一连串的加载,导致加载延长,进入源码查看后发现,其实 tab-bar-toolbar 更多的是引入类型,结果把文件都引入后,导致后面的一连串反应。所以要拆分出类型和实现,以便优化启动逻辑
Changelog
优化 ajv 的加载顺序