Skip to content

[Bug] group #188

@FedeRBeije

Description

@FedeRBeije

Environment

  • OS: [macOS]
  • Node Version: [v21.2.0]
  • Package: [@clack/prompts]
  • Package Version: [e.g. v0.7.0]

Describe the bug

  1. When i try to use group from @clack/prompts i get undefined as results
  2. If i just await group(... it print all in ones and i can't choose the values and does some strange glitch shows the outro but then it will removed it(video)
  3. The var that should have the values from group is undefined. Also in the video
  4. The onCancel method is not working. If i ctrl + c the program ends but not in the right way(video 2)

To Reproduce

Just create a group with select and multiselect

Steps to reproduce the behavior:

const templateGroup = await group(
      {
        language: async () => {
          await select({
            message: 'Select a language',
            options: [
              {label: 'Typescript', value: 'typescript'},
              {label: 'Javascript', value: 'javascript'},
            ],
            initialValue: 'typescript',
          })
        },
        config: async () => {
          await multiselect({
            message: 'Select the config you want to use',
            options: [
              {value: 'tailwind', label: 'Tailwind'},
              {value: 'tanstackQuery', label: 'Tanstack Query', hint: 'recommended'},
              {value: 'zustand', label: 'Zustand', hint: 'recommended'},
              {value: 'redux', label: 'Redux'},
            ],
            initialValues: ['tailwind', 'tanstackQuery', 'zustand'],
            required: true,
          })
        },
      },
      {
        onCancel: () => {
          console.log('Operation cancelled')
          cancel('Operation cancelled')
          process.exit(0)
        },
      },
    )
 outro(`You selected ${templateGroup.language} and ${JSON.stringify(templateGroup.config)} for your project!`)
  • Include reproduction steps

Expected behavior
I should get the values

Additional Information

image

Screen.Recording.2024-01-25.at.17.50.04.mov
Screen.Recording.2024-01-25.at.18.01.25.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions