-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ensure questions that set a data field with no option data values are not automated #3903
Conversation
Removed vultr server and associated DNS entries |
); | ||
if (!visitedFns) return; | ||
if (!visitedFns.length) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A filter
is always going to return an []
so the previous condition incorrectly always returned true!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice simple solution 👏
); | ||
if (!visitedFns) return; | ||
if (!visitedFns.length) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch 👍
validate: ({ options, ...values }) => { | ||
const errors: FormikErrors<FormikValues> = {}; | ||
if (values.fn && !options?.some((option) => option.data.val)) { | ||
errors.fn = | ||
"At least one option must set a data value when the checklist has a data field"; | ||
} | ||
return errors; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It would be nice to make these validation schemas for ease of expansion in future, but this could well be a YAGNI thing - they've been without any validation for a very long time!
Fixes edge case flagged here: https://opensystemslab.slack.com/archives/C5Q59R3HB/p1730455691984869
Two changes:
autoAnswerableOptions
condition is corrected so that existing nodes will behave as expected (put to user)Testing: