fix: stabilize deselect flow for outside click and next selection #5008
+28
−5
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 连接
fix #5006
💡 问题的背景&解决方案
背景:
用户反馈在部分交互下会出现“清理慢一拍”的现象:第二次选择未清掉第一次残留,第三次才清掉第二次。说明选中状态与边框组件在某些路径可能存在不同步。
解决方案:
本次改动不再使用等价替换(
dealTableSelect()->updateSelectPos(-1, -1)),改为稳定清理策略:StateManager增加clearSelectState(),强制清空ranges/cellPos/selecting/isSelectAll,并执行deleteAllSelectBorder();outsideClickDeselect路径改为调用clearSelectState(true),确保外部点击时旧选区被彻底清空;ranges.length > 0,避免依赖cellPos导致的“上一轮残留延迟到下一轮才清理”。这样可以覆盖“第一次没正常清除”的慢一拍场景,并让清理语义更一致。
📝 Changelog
☑️ 自测
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough