Fix strategy switch config sync conflicts#150
Conversation
Co-Authored-By: Codex <noreply@openai.com>
🤖 Codex PR ReviewPlease ensure a human reviewer checks this PR before merging. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90c2528912
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (configured !== "current") { | ||
| form.optionOverlayMode = configured; | ||
| return; |
There was a problem hiding this comment.
Gate saved option overlays by strategy support
When an account has option_overlay_mode: "enabled" saved and the user switches that account to a strategy without option overlay defaults, such as ibit_smart_dca, this early return keeps form.optionOverlayMode as enabled. The render path then disables the option-overlay select for unsupported strategies, while hasValidOptionOverlayPolicy() rejects enabled on unsupported strategies, leaving the dispatch button disabled with no way for the user to clear the saved mode from the UI.
Useful? React with 👍 / 👎.
| if (!form || allowMarginExplicitlySelected(form) || !form._prevReserve) return; | ||
| form.reservePolicyMode = form._prevReserve.mode; | ||
| form.minReservedCashUsd = form._prevReserve.floor; | ||
| form.reservedCashRatio = form._prevReserve.ratio; | ||
| form.reservedCashTouched = true; | ||
| delete form._prevReserve; |
There was a problem hiding this comment.
Clear stale saved reserve before restoring it
After a reserve policy is saved in _prevReserve by toggling allow-margin on, that field is not cleared when the user later changes accounts or explicitly changes the reserve policy to none. In those flows this restore path can resurrect the previous account's or previously-cleared reserve settings the next time allow-margin is toggled off, causing a dispatch with an unexpected reserve-cash override.
Useful? React with 👍 / 👎.
变更
验证