Skip to content
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

Nested call after prompt with async validation is not displayed. #878

Open
iKurisu opened this issue Jan 4, 2020 · 3 comments
Open

Nested call after prompt with async validation is not displayed. #878

iKurisu opened this issue Jan 4, 2020 · 3 comments

Comments

@iKurisu
Copy link

iKurisu commented Jan 4, 2020

inquirer
  .prompt([
    {
      type: "list",
      name: "action",
      message: "Choose action",
      choices: ["Sign in", "Sign up"]
    },
    {
      type: "input",
      name: "username",
      message: "Enter username",
      validate(username, { action }) {
        return new Promise(res => {
          // Check if user exists in a database and resolve the answer.
        });
      }
    }
  ])
  .then(answers => {
    // Make some queries to the database.

    inquirer.prompt({
      type: "list",
      name: "roomAction",
      message: "No rooms found",
      choices: ["Create room", "Join room"]
    });
  });

Produces:

? Choose action: Sign in
? Enter username: Someusername
(and it gets stuck here)

The same happens when the promise is resolved after a timeout, but it doesn't when the promise is instantly resolved.

@ptu14
Copy link

ptu14 commented Sep 7, 2020

Same problem here, can we expect a fix?

@wszydlak
Copy link

wszydlak commented Sep 8, 2020

Same here, i noticed that this only occurs on windows (PowerShell / cmd). It is properly working on bash.

@ptu14
Copy link

ptu14 commented Sep 8, 2020

@wszydlak thanks! I tried it in bash and it's worked. I spent more time with this problem and i also notice that it's only stuck when async validation is on the last question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants