[studio] fix: scope LLM operations to the current form - #755
Conversation
Signed-off-by: Rui <1685901819@qq.com>
97f56e7 to
0904d60
Compare
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Well-implemented fix for stale state updates in LlmSettings. The generation counter pattern (beginOperation/ownsOperation) correctly prevents async callbacks from updating state after the component unmounts or the user switches providers. This fixes a common React race condition where a slow test/save request could overwrite newer state.
LGTM — clean implementation with good test coverage.
Automated review by github-manager-bot
|
Closing: this area belongs to Track 3 (AI Native), which already has a complete design in progress (see #1024). Further LLM/AI changes should follow that design discussion instead of ad-hoc PRs. Thanks for the effort! / 关闭说明:该改动属于赛道三(AI Native)范围,赛道三已有完整的设计方案正在推进(见 #1024),LLM/AI 相关改动请跟随该设计讨论,不再单独接收零散 PR。感谢贡献! |
|
Reopened — the previous close was applied in error; it does not fall under the Track 3 batch closure. / 重新打开:刚才的关闭属误操作,此 PR 不在赛道 3 批量关闭范围内。 |
Summary
rocketmq-studiobranch and adapt it to the redesigned LLM settings flow from feat: add claude-code and qoder agent engines with streaming prompt enhance #954Fixes #738.
This remains separate from the initial configuration/model request ownership fixed by #737.
Root cause
handleTestandhandleSaveallowed every Promise callback to update the current form and shared loading/result state. A request started for an older form could therefore publish its result after the user changed provider, engine, or fields. An older explicit save could also clear a newly entered API key when its response arrived late.The fix uses a shared operation generation for result ownership and per-request generations for loading ownership. Form changes invalidate connection tests immediately, while an already-sent save keeps its loading guard until it settles so another mutation cannot be started accidentally.
Compatibility
provider,engine,enabled: true, empty-key retention, and the no-auto-save test behavior introduced by feat: add claude-code and qoder agent engines with streaming prompt enhance #954Verification
228ad5298dbbeaa769f1c1de242117c6cfbe4216git diff --check: passed