fix(hooks): fixed the issue where loading was not properly closed in some cases. #737
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.
部分情况下,图表触发renderChartBySize后,loading不会关闭,例如放在v-if、v-show中的chart,NTab中切换的chart,keepAlive之后的页面的chart。
复现路径:
造成这个bug的原因是:
使用这类的方式切换显示之后,useElementSize会侦测到他们的宽高变成0,进而触发针对width与height的watch,导致执行了renderChartBySize,切换回来后页面没有根据这个状态主动再次调用updateOptions(这个情况不应由页面去侦听调用),所以就导致图表数据正常,显示正常,但是loading会一直存在