Skip to content

Commit e292d52

Browse files
committed
refactor: Delete Component - deprecate 'setDeleting'
1 parent b619087 commit e292d52

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Common/DeleteComponentModal/DeleteComponent.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React, { useState } from 'react'
17+
import { useState } from 'react'
1818
import { useHistory } from 'react-router-dom'
1919
import info from '../../Assets/Icon/ic-info-filled.svg'
2020
import { ConfirmationDialog, DeleteDialog } from '../Dialogs'
@@ -42,7 +42,7 @@ const DeleteComponent = ({
4242
const { push } = useHistory()
4343

4444
async function handleDelete() {
45-
setDeleting(true)
45+
setDeleting?.(true)
4646
setIsDeleting(true)
4747
try {
4848
await deleteComponent(payload)
@@ -66,7 +66,7 @@ const DeleteComponent = ({
6666
showError(serverError)
6767
}
6868
} finally {
69-
setDeleting(false)
69+
setDeleting?.(false)
7070
setIsDeleting(false)
7171
}
7272
}

src/Common/DeleteComponentModal/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616

1717
export interface DeleteComponentProps {
18-
setDeleting: (boolean) => void
18+
/**
19+
* @deprecated - Delete component internally handles loading for the `Delete Button`.
20+
*/
21+
setDeleting?: (boolean) => void
1922
toggleConfirmation: any
2023
deleteComponent: (any) => Promise<any>
2124
title: string

0 commit comments

Comments
 (0)