Fix bug in target selector UI (#3419)

This commit is contained in:
gillespi314 2021-12-20 10:24:52 -08:00 committed by GitHub
parent 1c4bc0954c
commit c9e8f4aab0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -0,0 +1,2 @@
* Fix UI bug in target selector for query editor and policy editor where cancel button did not reset
selected targets

View file

@ -182,6 +182,11 @@ const SelectTargets = ({
}
);
const handleClickCancel = () => {
setSelectedTargets([]);
goToQueryEditor();
};
const handleSelectedLabels = (entity: ILabel | ITeam) => (
e: React.MouseEvent<HTMLButtonElement>
): void => {
@ -318,7 +323,7 @@ const SelectTargets = ({
<div className={`${baseClass}__targets-button-wrap`}>
<Button
className={`${baseClass}__btn`}
onClick={goToQueryEditor}
onClick={handleClickCancel}
variant="text-link"
>
Cancel

View file

@ -190,6 +190,11 @@ const SelectTargets = ({
}
);
const handleClickCancel = () => {
setSelectedTargets([]);
goToQueryEditor();
};
const handleSelectedLabels = (selectedLabel: ISelectTargetsEntity) => (
e: React.MouseEvent<HTMLButtonElement>
): void => {
@ -330,7 +335,7 @@ const SelectTargets = ({
<div className={`${baseClass}__targets-button-wrap`}>
<Button
className={`${baseClass}__btn`}
onClick={goToQueryEditor}
onClick={handleClickCancel}
variant="text-link"
>
Cancel