prompts
prompts copied to clipboard
onState() event doesn't fire on multiselect toggle
Describe the bug
onState() event doesn't fire when toggling an item in multi select prompt
To Reproduce
const items = await prompts({
message: "Select items",
type: "multiselect",
name: "items",
choices: [
{value: "value1", title: "item1"},
{value: "value2", title: "item2"}
],
onState(o) {
console.log(o);
}
});
Run and select/deselect items.
Expected behavior
onState() should fire when selecting/deselecting items in multi select.
System
- OS: MacOS 10.14.6
- Terminal: VSCode
- Node version: 13.12.0
@danielvy it looks like your callback is wrong though.
But the following doesn't fire on type select
.
{
type: 'select',
name: 'hello,
message: 'Hello world?',
choices: [
{ title: 'No', value: false },
{ title: 'Yes', value: true }
],
onState: (prev, values) => {
console.log(prev, values);
}
},