Skip to content

Commit 579f517

Browse files
Fixed build warnings
1 parent d7d10d2 commit 579f517

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

src/controls/modernTaxonomyPicker/taxonomyTree/TaxonomyTree.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ export function TaxonomyTree(props: ITaxonomyTreeProps): React.ReactElement<ITax
103103
}
104104
groupToAddTermTo.children = [...groupToAddTermTo.children ?? [], g];
105105
props.setTerms((prevTerms) => {
106-
const nonExistingTerms = newTermItems.filter((term) => prevTerms.every((prevTerm) => prevTerm.id !== term.id));
106+
const nonExistingTerms = newTermItems.filter((newTerm) => prevTerms.every((prevTerm) => prevTerm.id !== newTerm.id));
107107
return [...prevTerms, ...nonExistingTerms];
108108
});
109109
}
110-
}
110+
};
111111

112112
const updateTaxonomyTreeViewWithUpdatedTermItems = (updatedTermItems: ITermInfo[]): void => {
113113
for (const term of updatedTermItems) {
@@ -143,7 +143,7 @@ export function TaxonomyTree(props: ITaxonomyTreeProps): React.ReactElement<ITax
143143
return [...prevTerms.filter(t => t.id !== term.id), term];
144144
});
145145
}
146-
}
146+
};
147147

148148
const updateTaxonomyTreeViewWithDeletedTermItems = (deletedTermItems: ITermInfo[]): void => {
149149
for (const term of deletedTermItems) {
@@ -168,7 +168,7 @@ export function TaxonomyTree(props: ITaxonomyTreeProps): React.ReactElement<ITax
168168
return [...prevTerms.filter(t => t.id !== term.id)];
169169
});
170170
}
171-
}
171+
};
172172

173173
const updateTaxonomyTreeView = (newTermItems?: ITermInfo[], updatedTermItems?: ITermInfo[], deletedTermItems?: ITermInfo[]): void => {
174174
if (newTermItems) {
@@ -182,7 +182,7 @@ export function TaxonomyTree(props: ITaxonomyTreeProps): React.ReactElement<ITax
182182
if (deletedTermItems) {
183183
updateTaxonomyTreeViewWithDeletedTermItems(deletedTermItems);
184184
}
185-
}
185+
};
186186

187187
React.useEffect(() => {
188188
let termRootName = "";
@@ -405,7 +405,9 @@ export function TaxonomyTree(props: ITaxonomyTreeProps): React.ReactElement<ITax
405405
{p.label}
406406
</span>}
407407
onChange={(ev?: React.FormEvent<HTMLElement | HTMLInputElement>, checked?: boolean) => {
408-
props.selection && props.selection.setKeySelected(groupHeaderProps.group.key, checked, false);
408+
if (props.selection) {
409+
props.selection.setKeySelected(groupHeaderProps.group.key, checked, false);
410+
}
409411
}}
410412
/>
411413
<div className={styles.actionButtonContainer}>
@@ -425,8 +427,10 @@ export function TaxonomyTree(props: ITaxonomyTreeProps): React.ReactElement<ITax
425427
{p.text}
426428
</span>,
427429
onClick: () => {
428-
props.selection && props.selection.setAllSelected(false);
429-
props.selection && props.selection.setKeySelected(groupHeaderProps.group.key, true, false);
430+
if (props.selection) {
431+
props.selection.setAllSelected(false);
432+
props.selection.setKeySelected(groupHeaderProps.group.key, true, false);
433+
}
430434
}
431435
}];
432436

@@ -475,11 +479,15 @@ export function TaxonomyTree(props: ITaxonomyTreeProps): React.ReactElement<ITax
475479
onGroupHeaderKeyUp={(ev: React.KeyboardEvent<HTMLElement>, group: IGroup) => {
476480
if ((ev.key == " " || ev.key == "Enter" ) && !isDisabled) {
477481
if (props.allowMultipleSelections) {
478-
props.selection && props.selection.toggleKeySelected(headerProps.group.key);
482+
if (props.selection) {
483+
props.selection.toggleKeySelected(headerProps.group.key);
484+
}
479485
}
480486
else {
481-
props.selection && props.selection.setAllSelected(false);
482-
props.selection && props.selection.setKeySelected(headerProps.group.key, true, false);
487+
if (props.selection) {
488+
props.selection.setAllSelected(false);
489+
props.selection.setKeySelected(headerProps.group.key, true, false);
490+
}
483491
}
484492
}
485493
}}

0 commit comments

Comments
 (0)