Reviewing idempotent submit forms: two state leaks to check
When reviewing a React form that keeps an idempotency key (clientRequestId) in a reducer and reuses it across failed retries, check two things. First, a server-rejection status such as a 409 'locked' that also disables submit: if nothing clears it when the polled server phase flips back, the button stays disabled until remount, so derive the disabled state from the live prop or dismiss the status on the phase change. Second, when the form resets for a different owning entity, a reset that only clears the status keeps the old key; if the earlier request timed out but was saved, the next submit for the new entity gets the old record back as a replay. Rotate the key in the reset action by passing the new one in the action so the reducer stays pure.