Inquirer.js
Inquirer.js copied to clipboard
Nested call after prompt with async validation is not displayed.
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.
Same problem here, can we expect a fix?
Same here, i noticed that this only occurs on windows (PowerShell / cmd). It is properly working on bash.
@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.