Skip to content

Commit bdb4920

Browse files
committed
fix validity checks
1 parent d9f35c5 commit bdb4920

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

static/app/views/explore/metrics/equationBuilder.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ export function EquationBuilder({
102102
new Set(Object.keys(expressionMapRef.current ?? {}))
103103
);
104104
const resolved = resolveExpression(expr, referenceMap);
105-
if (resolved.isValid) {
105+
106+
// Check the validity of the internal expression, not the resolved one because
107+
// there are issues with validating it with the new _if aggregation format and
108+
// this check just needs to ensure the structure is valid.
109+
if (expr.isValid) {
106110
handleExpressionChange(resolved);
107111
expressionMapRef.current = referenceMap;
108112
}
@@ -112,7 +116,9 @@ export function EquationBuilder({
112116
const handleInternalExpressionChange = useCallback(
113117
(newExpression: Expression) => {
114118
startTransition(() => {
115-
handleExpressionChange(resolveExpression(newExpression, referenceMap));
119+
if (newExpression.isValid) {
120+
handleExpressionChange(resolveExpression(newExpression, referenceMap));
121+
}
116122
});
117123
},
118124
[handleExpressionChange, referenceMap]

static/app/views/explore/metrics/metricToolbar/index.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ export function MetricToolbar({
6060

6161
const handleExpressionChange = useCallback(
6262
(newExpression: Expression) => {
63-
const isValid = newExpression.isValid;
64-
if (!isValid) {
65-
return;
66-
}
6763
setVisualize(visualize.replace({yAxis: `${EQUATION_PREFIX}${newExpression.text}`}));
6864
},
6965
[setVisualize, visualize]

0 commit comments

Comments
 (0)