Repository navigation
fix(question bank UI): prevent stale external reads from overwriting local token changes - #239
Merged
Merged
Conversation
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.
问题
在 #236 合并后,「题库与搜题」会响应普通查题后发出的余额变更事件,异步调用
questionBankList()读取本地保险库快照。但这类外部事件引发的只读请求原先只与其他读取请求通过listReadId排序,不会在用户主动修改 Token 时失效。具体竞态:外部读取先发出 → 用户导入/删除 Token,后端返回新保险库快照并更新 UI → 旧的外部读取迟到,覆盖掉更新后的 Token 列表或显示过时错误。数据后端仍正确,但 UI 误导用户,甚至造成重复操作。
修复
beginMutation(),在开始已有 6 种本地修改/检测操作之前,使在途的外部只读请求失效,然后沿用原有busy状态。questionBankList()成功或失败均无法覆盖修改结果;修改期间的新外部事件依旧延后到空闲时只读刷新。验收
新增
frontend/tests/questionBankExternalReadMutationRace.test.cjs,真实挂载题库设置面板并注入延迟返回的外部事件读取:走完整 Python、React/UI 和 Windows NSIS CI 后再合并。