5 min readUpdated Mar 2, 2026

DeleteConfirmModal Documentation

Overview

The DeleteConfirmModal component is a dialog that prompts users to confirm the deletion of an entity within the Vantage analytics and data platform. It is designed for critical actions where users must verify their intention to delete, as this action cannot be undone. The modal can handle various types of deletions, such as organizations, clients, and users, displaying relevant information based on the type of entity being deleted.

Purpose

The purpose of this component is to provide a clear and engaging interface for users to confirm dangerous actions like deletions. It informs users of all entities that will be affected by the deletion and provides an option to reassign users instead of deleting them when appropriate. The component promotes a user-friendly approach to confirmation of sensitive operations.

Settings

1. open

2. onClose

3. onConfirm

4. entityType

5. entityName

6. affectedClients

7. affectedUsers

8. availableClients

How It Works

The DeleteConfirmModal component utilizes several internal states and effects:

  1. State Management: It manages two pieces of state: reassignClientId, which tracks the selected client for reassignment, and confirming, which indicates if the delete operation is in progress.
  2. Effect Hook: When the modal opens, it resets the state variables to ensure a fresh start with every presentation of the modal.
  3. Event Handling: Clicking the confirmation button triggers the handleConfirm function, which calls the onConfirm callback with the selected reassignment ID (if available).
  4. Rendering Conditionality: The modal conditionally renders content based on the entity type and the lengths of affected clients and users arrays, ensuring that relevant information is displayed correctly.

Use Cases & Examples

Use Cases

  1. Organization Deletion: A user wants to delete an organization and needs to know which clients and users will be affected by this action.
  2. Client Deletion: A user needs to delete a client and has users associated with that client. The user must decide whether to reassign users to another client or delete them.
  3. User Deletion: An admin removes a user from the system, ensuring they understand the implications of this deletion.

Example Configuration

Use Case: Deleting a Client (client) and Reassigning Users

javascript
<DeleteConfirmModal
    open={isModalOpen}
    onClose={handleCloseModal}
    onConfirm={handleDeleteClient}
    entityType='client'
    entityName='Acme Corp'
    affectedClients={[]}  // No clients are affected in this case.
    affectedUsers={[
        { id: 1, email: 'john.doe@example.com', first_name: 'John', last_name: 'Doe' },
        { id: 2, email: 'jane.smith@example.com', first_name: 'Jane', last_name: 'Smith' },
    ]}
    availableClients={[
        { id: 3, name: 'Tech Solutions Inc.' },
        { id: 4, name: 'Innovate LLC' },
    ]}
/>

In this configuration: