Closed ElvisWong closed 1 year ago
It crashes when I tab on "Tab" button for autocomplete. This is how I works with inquirer modules.
await inquirer.prompt([ { type: "autocomplete", name: "product", message: `test`, suggestOnly: true, source: function (ans, input) { return new Promise(async function (res) { const search = input ? await Product.find({ name: { $regex: new RegExp(input, `i`) }, }).lean() : []; const choices = search.map((x) => ({ name: x.name, value: x, })); res(choices); }); }, }, ]);
This error happens when I set value as object to the source function. Once I changed back the value to string, It works fine.
source
I can no longer reproduce this. Keep in mind also that with suggestonly it is basically a regular text input. So if you have an object there that is not really supported.
Attempted this, pressing tab works fine.
https://github.com/mokkabonna/inquirer-autocomplete-prompt/commit/644f8704b8ed487f02a86d36fbdeeede554cdac7
It crashes when I tab on "Tab" button for autocomplete. This is how I works with inquirer modules.
This error happens when I set value as object to the
source
function. Once I changed back the value to string, It works fine.