fix(vchart): fix mark state persistence issue during updateSpec#4518
Open
xuefei1313 wants to merge 2 commits intodevelopfrom
Open
fix(vchart): fix mark state persistence issue during updateSpec#4518xuefei1313 wants to merge 2 commits intodevelopfrom
xuefei1313 wants to merge 2 commits intodevelopfrom
Conversation
xuefei1313
commented
Mar 19, 2026
| this.state.clearAllStateInfo(); | ||
| this.uncommit(); | ||
| this.stateStyle = {}; | ||
| this.getGraphics().forEach(g => { |
Contributor
Author
There was a problem hiding this comment.
clearBeforeReInit 目前只对 getGraphics() 返回的图元调用了 clearStates(),但不会清理 mark 的 _product(group)与 _graphicMap 上已有的 states。建议在重载前同时清理这些对象的 states,避免 state 写入时产生残留。
参考建议:
clearBeforeReInit() {
this.state.clearAllStateInfo();
this.uncommit();
this.stateStyle = {};
this._product?.clearStates();
this._graphics.forEach(g => {
g.clearStates();
});
this._graphicMap.forEach(g => {
g.clearStates();
});
}| return; | ||
| } | ||
| this._product = mark.getProduct(); | ||
| this._product.clearStates(); |
Contributor
Author
There was a problem hiding this comment.
BaseMark.reuse 中无条件清理 states 会导致交互态(hover/select 等)在非 updateSpec 路径(如常规 compile)中被重置。建议确认是否应将清理逻辑更精准地收敛在 reInit/updateSpec 相关路径。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
🔗 Related PR link
🐞 Bugserver case id
💡 Background and solution
Fix an issue where mark states were not properly cleared when
updateSpecwas called, causing incorrect state persistence.The
updateSpecprocess re-initializes marks but previous state information was lingering.Changes include:
clearAllStateInfomethod toIMarkStateManagerinterface and implementation.clearBeforeReInitmethod toIMarkRawinterface and implementation.clearBeforeReInitinBaseMarkduring re-initialization.BaseSeriesto handle state cleanup during spec updates.📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough