We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 530876a commit e7228cbCopy full SHA for e7228cb
1 file changed
src/taxonomy/tag-list/DeleteModal.tsx
@@ -25,10 +25,6 @@ const DeleteModal = ({
25
}: DeleteModalProps) => {
26
const intl = useIntl();
27
28
- if (!row) {
29
- return null;
30
- }
31
-
32
const handleConfirm = (row: Row<TreeRowData>) => {
33
handleDeleteRow(row);
34
setIsOpen(false);
@@ -40,8 +36,12 @@ const DeleteModal = ({
40
36
setRow(null);
41
37
};
42
38
43
- const rowData = getTagListRowData(row);
44
- const count = useMemo(() => getTagWithDescendantsCount(rowData), [rowData]);
39
+ const rowData = row ? getTagListRowData(row) : null;
+ const count = useMemo(() => (rowData ? getTagWithDescendantsCount(rowData) : 0), [rowData]);
+
+ if (!row) {
+ return null;
+ }
45
46
const hasSubtags = count > 1;
47
const typeToDeleteText = hasSubtags
0 commit comments