fix(core): 修复空状态后的单属性更新失效与图例截断 - #2138
Merged
Merged
Conversation
skie1997
reviewed
Sep 20, 2026
skie1997
left a comment
Contributor
There was a problem hiding this comment.
Review 完成,复核结论已评论到属性写入对应代码行,未发现明确的新增代码缺陷。
本地复核:属性分层 14 项、动画/状态集成 50 项、Electron 图例 6 项,共 70 项通过。使用 PR 源码及本机已有依赖;图例测试因本机 Node 类型与无关 table-series-number 组件的 setTimeout 类型冲突,关闭了 ts-jest diagnostics 后验证运行时行为,不能算作完整类型检查通过。远端 Unit test CI 为通过。
验证边界:Bug Server CI 返回 status=ok、totalCount=2354、successCount=2319,仍有 35 项未通过。本轮没有逐项核对这些截图差异,不能确认其均为修复带来的预期变化,建议合并前核对差异。
| if (this.canCommitBaseAttributesByTouchedKeys()) { | ||
| this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context); | ||
| } else { | ||
| this.detachAttributeFromBaseAttributes(); |
Contributor
There was a problem hiding this comment.
已复核这处调用位置:空状态会让 attribute 与 baseAttributes 保持共享,必须先分离、再写基础属性,后面的 _syncAttribute() 才能保留旧生效值并计算正确 delta。此处与 _setAttributes() / commitInternalBaseAttributes() 的已有慢路径一致,普通单属性快速路径不受影响。
本地属性分层和动画/状态相关 64 项测试通过,真实 Canvas 图例 6 项也通过(图例运行时验证关闭了本机不匹配类型导致的 ts-jest diagnostics)。本轮未发现需要修改的代码问题;全量截图回归仍有 35 项未通过,详见本次 review 总结。
skie1997
approved these changes
Sep 20, 2026
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.
🤔 这个分支是...
🔗 相关 issue 连接
原始问题见下方 chartspace4 用例;触发提交为 0f5ead77a(
perf(core): skip empty state attribute commits)。🐞 Bugserver 用例 id
原始用例属于 chartspace4:
stroke-series-color。
💡 问题的背景&解决方案
固定宽度图例同时显示系列名和 value 时,默认空
selected状态会保留attribute与baseAttributes的共享存储。图例先测量文字,再调用setAttribute('maxLineWidth', ...);单属性慢路径先修改共享对象,导致后续差异检测为空,未失效的文本缓存继续显示完整test1,基准应为t…。本次在
Graphic.setAttribute慢路径写入前调用已有detachAttributeFromBaseAttributes(),与_setAttributes和commitInternalBaseAttributes对齐。保留普通单属性快速路径和空状态跳过提交优化,不在图例组件增加特殊处理,不修改公开 API 或依赖版本。新增回归覆盖:
先运行新增测试确认失败,再实施一行运行时修复。真实图例对照结果为
test1→t…;现有should omit when label's width exceeds item's width测试也由失败恢复通过。📝 Changelog
☑️ 自测
rush test --only tag:package:7 个包的源码测试全部通过(1,229 个测试通过,既有 10 个测试跳过)。rush compile -t @visactor/vrender-components:core / animate / kits / components 依赖链编译通过。git diff --check通过。10k 图元属性更新微基准(macOS arm64、Node v24.19.0;3 轮预热、7 轮中位数;空 graphic service,不含 Canvas 渲染):
首次更新增加约 0.947 ms,并将正确产生形状失效的图元数从 0 恢复为 10,000。其余两类中位数变化约 +1.85% / -1.03%;结果用于检查属性路径成本,不代表端到端帧率。
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough