Skip to content

Follow-ups from the #4198 reviews: a late Create success after an external close and reopen resets the newer product draft #4231

Closed

Description

@yannickmonney

These follow-ups come from the two independent reviews of #4198 (TALE-343), which merged at de0e5dc10 (03:15:10Z):

The fleet manager (TALE-357) filed this so the open findings are tracked in one place.

1. A late Create success after an external close and reopen resets the newer draft

  • Where: services/platform/app/features/products/components/product-create-dialog.tsx. The mutation promise's success callback still calls handleClose() unconditionally. The new onOpenChange guard blocks Radix dismissal only while this mounted dialog instance reports isSubmitting.
  • Scenario:
    1. Submit Create. While the write is pending, the parent sets isOpen to false and then true; a route- or context-driven close followed by a reopen does this.
    2. The same component instance stays mounted. Enter a new draft.
    3. The old write resolves.
  • Actual (from source): the old callback resets the newer draft and calls onClose.
  • Expected: a response only acts on the submission and draft generation that sent it. An external close or reopen invalidates it.

2. LOW: after a success, the next draft validates on every keystroke

  • Cause: the reset runs inside the promise that handleSubmit awaits. React Hook Form then sets isSubmitted: true after it, and the dialog stays mounted.
  • Effect: after reopening, clearing Product name shows "Name is required" before blur, which breaks the app-wide onTouched policy.
  • Fix direction: close and reset after handleSubmit settles.

3. LOW: a write that never settles keeps the modal open with no way out

This happens offline (TanStack Query's default networkMode: 'online' pauses the mutation) or on a stalled POST. It matches FormDialog's policy, but it's new for this dialog and untested. Either decide the policy and record it, or give the person a way out.

Acceptance

  • Item 1: a regression closes and reopens the dialog externally while a deferred write is pending, enters a new draft, resolves the old write, and asserts the new draft remains and onClose isn't called.
  • Item 2: a regression goes success, reopen, type, clear Name, and asserts no error before blur.
  • Item 3: fixed or recorded as a decision.
  • The fix(platform): preserve product create submission lifecycle #4198 controls still pass: repeat Create is blocked, pending Back, Escape and close are refused, a refusal keeps the draft, and a healthy success resets.
  • An independent review by a distinct agent.

Related: #4198, TALE-343, TALE-538.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions