修复GDD审批同步期间提交竞态
审批按钮在 hydrate 期间统一禁用 修改和退回弹窗提交复用同一忙碌状态门禁 提交处理函数同步阻止过期 pending 决定
This commit is contained in:
@@ -376,12 +376,13 @@ export function GddApprovalCard({
|
||||
const canDecide = Boolean(
|
||||
pending && state.state === 'ready_for_approval' && !state.recoveryPending,
|
||||
);
|
||||
const decisionDisabled = !canDecide || decisionBusy || hydrateBusy;
|
||||
|
||||
const submitComment = () => {
|
||||
// 方案 §18.2:`recoveryPending` 期间只允许重试同一 ID,不允许提交决定。触发按钮
|
||||
// 已经由 `canDecide` 门住,但弹层是打开后才可能被后台 hydrate 翻掉资格的,
|
||||
// 所以提交口要自己再判一次,不能只靠按钮 disabled。
|
||||
if (!canDecide || !commentAction || !comment.trim()) {
|
||||
if (decisionDisabled || !commentAction || !comment.trim()) {
|
||||
return;
|
||||
}
|
||||
void onDecision(commentAction, comment.trim())
|
||||
@@ -438,7 +439,7 @@ export function GddApprovalCard({
|
||||
<div className="gdd-approval-card__actions">
|
||||
<button
|
||||
type="button"
|
||||
disabled={!canDecide || decisionBusy}
|
||||
disabled={decisionDisabled}
|
||||
onClick={() =>
|
||||
void onDecision('approve', null).catch(() => undefined)
|
||||
}
|
||||
@@ -447,14 +448,14 @@ export function GddApprovalCard({
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
disabled={!canDecide || decisionBusy}
|
||||
disabled={decisionDisabled}
|
||||
onClick={() => setCommentAction('revise')}
|
||||
>
|
||||
修改
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
disabled={!canDecide || decisionBusy}
|
||||
disabled={decisionDisabled}
|
||||
onClick={() => setCommentAction('reject')}
|
||||
>
|
||||
退回重做
|
||||
@@ -507,7 +508,7 @@ export function GddApprovalCard({
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
disabled={!canDecide || decisionBusy || !comment.trim()}
|
||||
disabled={decisionDisabled || !comment.trim()}
|
||||
onClick={submitComment}
|
||||
>
|
||||
{decisionBusy ? '提交中' : '提交决定'}
|
||||
|
||||
Reference in New Issue
Block a user