Skip to content

Commit ac1a400

Browse files
committed
chore: stop propagation mandate for all delete events
1 parent 2aa3684 commit ac1a400

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/Shared/Components/ConfirmationModal/DeleteConfirmationModal.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import React, { useState } from 'react'
1818
import { ToastManager, ToastVariantType } from '@Shared/Services/ToastManager'
1919
import { ServerErrors } from '@Common/ServerError'
20-
import { showError } from '@Common/Helper'
20+
import { showError, stopPropagation } from '@Common/Helper'
2121
import { ConfirmationModalVariantType, DeleteConfirmationModalProps } from './types'
2222
import ConfirmationModal from './ConfirmationModal'
2323
import { CannotDeleteModal } from './CannotDeleteModal'
@@ -47,7 +47,9 @@ export const DeleteConfirmationModal: React.FC<DeleteConfirmationModalProps> = (
4747
const [isLoading, setLoading] = useState(isDeleting)
4848

4949
const handleDelete = async (e: React.MouseEvent<HTMLButtonElement>) => {
50-
e.stopPropagation()
50+
if (e) {
51+
stopPropagation(e)
52+
}
5153

5254
setLoading(true)
5355
try {
@@ -57,7 +59,6 @@ export const DeleteConfirmationModal: React.FC<DeleteConfirmationModalProps> = (
5759
description: successToastMessage || 'Successfully deleted',
5860
})
5961
setLoading(false)
60-
6162
closeConfirmationModal()
6263
} catch (serverError) {
6364
if (serverError instanceof ServerErrors && serverError.code === errorCodeToShowCannotDeleteDialog) {

src/Shared/Components/ConfirmationModal/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ export interface DeleteConfirmationModalProps
154154
*/
155155
onError?: (error) => void
156156
// Additional Configuration
157-
/**
158-
* Boolean to determine if event propagation should be stopped.
159-
*/
160-
shouldStopPropagation?: boolean
161157
/**
162158
* Boolean to disable the delete action.
163159
*/

0 commit comments

Comments
 (0)