Implement a queue system or throw an error when prompt
is called before previous one has ended.
#64
Labels
prompt
is called before previous one has ended.
#64
Migrated from #62 (separate issue that was brought up)
Test case
Currently this just breaks
inquirer
.I can't think of any reason why someone would need to call
prompt
like this as you should just pass multiple questions toprompt
and if you need to split it up (you need to calculate some questions based on previous answers and the calculation includes async calls sowhen
will not work) then you would need to do it the proper way (from within the callback).I propose two options:
Option 1
Throw an error if
inquirer.prompt
is called before a previous call has finished (removed event listeners and called callback).Option 2
Implement a queue: https://github.com/pull-requests/Inquirer.js/compare/queue
This isn't currently working properly (some tests hang - not sure why), but you get the general idea.
Option 1 would be dead simple to implement and I feel that option 2 is just helping people who haven't grasped how async works and aren't using
inquirer
properly anyway. Part of me thinks that it would be better for them if we throw an error as they will then understand that they need to use callbacks and can't just call them serially.The text was updated successfully, but these errors were encountered: