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

v1.1.1 causes re-display of the answers of list-type prompts after each new prompt is accepted #395

Closed
digiwano opened this issue Jul 7, 2016 · 2 comments

Comments

@digiwano
Copy link

digiwano commented Jul 7, 2016

code to reproduce:

'use strict';

const inquirer = require('inquirer');

const questions = [
  {
    type: 'list',
    name: 'q1',
    message: 'question-1',
    choices: ['one', 'seven', 'twelve'],
  },
  {
    type: 'input',
    name: 'q2',
    message: 'question-2',
    default: () => 'two',
  },
  {
    type: 'input',
    name: 'q3',
    message: 'question-3',
    default: () => 'three',
  },
];

inquirer.prompt(questions).then(console.log);

Under v1.1.0:
inquirer-v1 1 0

Under v1.1.1:
inquirer-v1 1 1

The flow goes something like this:

  1. List-type question is displayed. After selecting the user's choice, the ? question-1 one is rendered.
  2. Next question is asked. At this point, on-screen, you have the Q1 line above, and the Q2 prompt. As soon as you hit 'enter' to accept your Q2 choice, it re-renders ? question-1 one followed by ? question-2 two, and it is only at this point that the ? question-1 one line has been duplicated.
  3. Again, at the point that Q3 is asked, you see ? question-1 one, then ? question-1 one, then ? question-2 two, then the active prompt-line for Q3. Once Q3 has been answered, it will then re-render again ? question-1 one followed by ? question-3 three, resulting in the state seen in the above screenshot.
@SBoudrias
Copy link
Owner

Woooo, not good! Fixed :)

Thanks for the report!

@olso
Copy link

olso commented Jul 7, 2016

Publish to npm please 👍 @SBoudrias

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