fix(settings): preserve drafts after rejected saves (#551)

Keep unsaved settings and their revision when the management API rejects a
request with a structured 4xx response. Continue reconciling settings for
uncertain write outcomes, including transport failures and server errors.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Yuqi Xiong
2026-10-30 10:54:05 +08:00
committed by GitHub
co-authored by Codex
parent 0e1c609cd9
commit b3dd9b5337
@@ -414,8 +414,11 @@ export function useSettingsForm() {
})
}, {
onError: (cause) => {
if (cause instanceof ApiError && cause.status !== 409)
// 明确拒绝的请求保留草稿,执行结果未知时仍回读设置以同步已提交的版本
if (cause instanceof ApiError && cause.status !== 409
&& (cause.kind !== 'api' || cause.status < 400 || cause.status >= 500)) {
void loadSettings(true)
}
},
})
}