Skip to content

Commit

Permalink
fix(match-exp): match-expression-evaluator handles non-empty match-ex…
Browse files Browse the repository at this point in the history
…pr with no target selected (#578)

* fix issue

* format:apply

* update label

Co-authored-by: Andrew Azores <me@andrewazor.es>
  • Loading branch information
maxcao13 and andrewazores authored Oct 27, 2022
1 parent e220ce9 commit 9ec2f03
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/app/Shared/MatchExpressionEvaluator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const MatchExpressionEvaluator: React.FunctionComponent<MatchExpressionEv

React.useEffect(() => {
addSubscription(context.target.target().subscribe(setTarget));
}, [addSubscription, context, context.target]);
}, [addSubscription, context.target, setTarget]);

React.useEffect(() => {
if (!props.matchExpression || !target?.connectUrl) {
Expand All @@ -95,7 +95,7 @@ export const MatchExpressionEvaluator: React.FunctionComponent<MatchExpressionEv
setValid(ValidatedOptions.error);
return;
}
}, [target, props.matchExpression]);
}, [target, props.matchExpression, setValid]);

React.useEffect(() => {
if (!!props.onChange) {
Expand Down Expand Up @@ -124,13 +124,20 @@ export const MatchExpressionEvaluator: React.FunctionComponent<MatchExpressionEv
</Label>
);
default:
if (!target?.connectUrl) {
return (
<Label color="grey" icon={<InfoCircleIcon />}>
No Target Selected
</Label>
);
}
return (
<Label color="grey" icon={<InfoCircleIcon />}>
No Match Expression
</Label>
);
}
}, [valid]);
}, [valid, target?.connectUrl]);

const exampleExpression = React.useMemo(() => {
let body: string;
Expand Down

0 comments on commit 9ec2f03

Please sign in to comment.