Skip to content

Commit

Permalink
Fix bugs found during PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHassanabad committed Nov 6, 2020
1 parent a998547 commit 6ac90aa
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ export const schema: FormSchema<DefineStepRule> = {
...args: Parameters<ValidationFunc>
): ReturnType<ValidationFunc<{}, ERROR_CODE>> | undefined => {
const [{ value, path, formData }] = args;
const { query, filters, edited } = value as DefineStepRule['queryBar'];
const { query, filters } = value as DefineStepRule['queryBar'];
const needsValidation = !isMlRule(formData.ruleType);
if (!needsValidation || edited === false) {
if (!needsValidation) {
return;
}

return isEmpty(query.query as string) && isEmpty(filters)
? {
code: 'ERR_FIELD_MISSING',
Expand All @@ -97,9 +96,9 @@ export const schema: FormSchema<DefineStepRule> = {
...args: Parameters<ValidationFunc>
): ReturnType<ValidationFunc<{}, ERROR_CODE>> | undefined => {
const [{ value, path, formData }] = args;
const { query, edited } = value as DefineStepRule['queryBar'];
const { query } = value as DefineStepRule['queryBar'];
const needsValidation = !isMlRule(formData.ruleType);
if (!needsValidation || edited === false) {
if (!needsValidation) {
return;
}

Expand Down

0 comments on commit 6ac90aa

Please sign in to comment.