Skip to content

fix: close remove-association confirm dialog after mutation succeeds#140

Open
Rishavraaj wants to merge 2 commits into
mainfrom
fix/remove-association-dialog-not-closing
Open

fix: close remove-association confirm dialog after mutation succeeds#140
Rishavraaj wants to merge 2 commits into
mainfrom
fix/remove-association-dialog-not-closing

Conversation

@Rishavraaj
Copy link
Copy Markdown
Contributor

@Rishavraaj Rishavraaj commented May 25, 2026

Summary

  • Removing an associated contact or company from a deal/company detail page was not closing the confirm dialog after the action completed
  • The onSuccess handlers in removeContactMutation and removeCompanyMutation were missing the state reset calls, so the dialog stayed open
    indefinitely
  • Fixed by calling setContactToRemove(null) / setCompanyToRemove(null) at the start of each onSuccess

Files Changed

  • DealDetail.tsx — reset contact and company remove state on mutation success
  • CompanyDetail.tsx — reset contact remove state on mutation success

Tests

  • Added unit tests for contact/company removal dialogs in deals.test.tsx and companies.test.tsx
  • Added E2E tests in deals.spec.ts verifying the dialog closes automatically after confirming removal
  • Updated companies.spec.ts to assert the dialog closes without pressing Escape
  • Removed the Escape-key workaround from CompanyDetailPage.removeContact()
  • Added removeContact and removeCompany helpers to DealDetailPage

Test Plan

  • Remove a contact from a deal — confirm dialog closes after clicking Remove
  • Remove a company from a deal — confirm dialog closes after clicking Remove
  • Remove a contact from a company — confirm dialog closes after clicking Remove
  • Cancel the remove dialog — dialog closes, no removal happens

Rishavraaj and others added 2 commits May 25, 2026 14:27
The ConfirmDialog for removing a contact or company from a deal/company
detail page was not closing after the mutation completed because the
onSuccess handlers never reset the state variables that control the
dialog's open prop.

Added setContactToRemove(null) and setCompanyToRemove(null) as the
first action in each onSuccess handler so the dialog closes immediately
once the API call succeeds.

Also adds unit tests covering the open/close/cancel behaviour and E2E
tests verifying the dialog closes without requiring manual Escape.
Removes the Escape-key workaround from CompanyDetailPage.removeContact
and adds removeContact/removeCompany helpers to DealDetailPage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- BasePage.updateTableCell: date and number inputs save on blur, not
  Enter. Detect input type and call blur() for those types so the
  'can create a new deal' date-column edit no longer times out.

- Deal Associations - Company Removal Dialog: create a fresh company in
  beforeAll so the 'Add Company' dropdown is never empty in a clean
  test environment.

- Company contact removal test: after the confirm dialog closes, wait
  for the contact link to detach from the DOM before asserting
  isContactAssociated, avoiding a race with the refetch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant