Skip to content

Commit

Permalink
addresses comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dplumlee committed Jun 16, 2023
1 parent 64b5077 commit 69cbf20
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ const BulkAlertTagsPanelComponent: React.FC<BulkAlertTagsPanelComponentProps> =
[existingTags, defaultAlertTagOptions]
);

const tagsToAdd: Record<string, boolean> = useMemo(() => ({}), []);
const tagsToRemove: Record<string, boolean> = useMemo(() => ({}), []);
const tagsToAdd: Set<string> = useMemo(() => new Set(), []);
const tagsToRemove: Set<string> = useMemo(() => new Set(), []);

const onUpdateSuccess = useCallback(
(updated: number, conflicts: number) => {
Expand Down Expand Up @@ -82,8 +82,8 @@ const BulkAlertTagsPanelComponent: React.FC<BulkAlertTagsPanelComponentProps> =
closePopoverMenu();
const ids = alertItems.map((item) => item._id);
const query: Record<string, unknown> = getUpdateAlertsQuery(ids).query;
const tagsToAddArray = Object.keys(tagsToAdd);
const tagsToRemoveArray = Object.keys(tagsToRemove);
const tagsToAddArray = Array.from(tagsToAdd);
const tagsToRemoveArray = Array.from(tagsToRemove);
try {
setIsLoading(true);

Expand Down Expand Up @@ -125,11 +125,11 @@ const BulkAlertTagsPanelComponent: React.FC<BulkAlertTagsPanelComponentProps> =
changedOption: EuiSelectableOption
) => {
if (changedOption.checked === 'on') {
tagsToAdd[changedOption.label] = true;
delete tagsToRemove[changedOption.label];
tagsToAdd.add(changedOption.label);
tagsToRemove.delete(changedOption.label);
} else if (!changedOption.checked) {
tagsToRemove[changedOption.label] = true;
delete tagsToAdd[changedOption.label];
tagsToRemove.add(changedOption.label);
tagsToAdd.delete(changedOption.label);
}
setSelectableAlertTags(newOptions);
};
Expand Down

0 comments on commit 69cbf20

Please sign in to comment.