You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multisearch functionality does not operate correctly when dealing with nested choices that have repeated names. This issue arises when using the library to create a multiselect prompt with a nested structure where some choices share the same name. Below is a code snippet that replicates the problem.
OS: macOS 14.2.1
Node Version: v20.10.0
Enquirer Version: 2.4.1
Error Messages: No specific error messages are generated, but the selection behavior does not work as expected with nested choices having identical names.
Extensions/Plugins/Helpers: N/A
Code to Reproduce
importEnquirerfrom'enquirer';newEnquirer.prompts.MultiSelect({name: 'test-multiselect-bug',hint: '(Use <space> to select, <return> to submit)',message: 'Please select from list file:',choices: [{"name": "baz/",choices: [{"name": "foo/",choices: [{"name": "bar/","choices": [{"name": "bar",}]}]}]},{"name": "foo/","choices": [{"name": "bar/",choices: [{"name": "bar",},]}]},],result(choices){returnthis.map(choices);},validate(value){if(value.length){returntrue;}return'Failed.';},}).run();
@jeylost thanks for creating the issue and for the detailed explanation of what's happening. I'm working on a new release and will make sure this gets addressed.
Issue Description
Multisearch functionality does not operate correctly when dealing with nested choices that have repeated names. This issue arises when using the library to create a multiselect prompt with a nested structure where some choices share the same name. Below is a code snippet that replicates the problem.
OS: macOS 14.2.1
Node Version: v20.10.0
Enquirer Version: 2.4.1
Error Messages: No specific error messages are generated, but the selection behavior does not work as expected with nested choices having identical names.
Extensions/Plugins/Helpers: N/A
Code to Reproduce
test repo
Workaround
Inserting ZWSPs in the names makes them unique to JavaScript's string comparison while still appearing visually similar in the terminal.
Example
Visual representation
test.mov
The text was updated successfully, but these errors were encountered: