Skip to content

Commit

Permalink
fix: field validation condition is fixed if the “when” condition is d…
Browse files Browse the repository at this point in the history
…efined (#697)
  • Loading branch information
alex-gilin authored Apr 16, 2024
1 parent 4cf5a26 commit 9f72b62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/inquirer-gui/src/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ export default {
const whenPromise = question.when(answers);
whenPromises.push(whenPromise);
let response = await whenPromise;
// When question was shouldShow === false, and
// it becomes shouldShow === true, call validate()
if (!question.shouldShow && response) {
// When question was shouldShow === false or question is invalid, and
// it becomes shouldShow === true, call validate()
if ((!question.shouldShow || !question.isValid) && response) {
shouldValidate = true;
}
question.shouldShow = response;
Expand Down

0 comments on commit 9f72b62

Please sign in to comment.