SBoudrias / Inquirer.js

A collection of common interactive command line user interfaces.
MIT License
20.29k stars 1.3k forks source link

Behaviour change from inquirer 10.2.1 to 10.2.2 #1555

Closed ansf closed 2 months ago

ansf commented 2 months ago

With inquirer 10.2.1 the following snippet would not prompt and just return undefined. With inquirer 10.2.2 however, the prompt is shown and the value is returned accordingly.

Since this was a patch release, I think this change was not intentional. It is breaking our scripts where we use when to disable prompts depending on the answer of previous prompts.

Reproducer:

import inquirer from 'inquirer'

const { tag } = await inquirer.prompt([
    {
        name: 'tag',
        type: 'confirm',
        message: 'Add tags?',
        default: true,
        when: () => undefined
    }
])

Run with inquirer 10.2.1 and 10.2.2 and observer the difference in behaviour (I can provide a full working reproducer as a repository if that helps).

SBoudrias commented 2 months ago

Thanks for the report, the fix is out in inquirer@11.0.2.

v11 isn't an API breaking change, we just reviewed some design decision in look and feel. So I'm hoping it'll be easy to update.

ansf commented 2 months ago

Thank you for the quick fix! I can confirm that it is now working as expected.