Skip to content

[Bug] #320

Closed
Closed
[Bug]#320
@qodesmith

Description

@qodesmith

Environment

  • OS:macOS, Windows
  • Node Version: Bun v1.2.13
  • Package: @clack/prompts
  • Package Version: ^0.10.1

Describe the bug
When using the text(...) component with a placeholder value and the validate function returns an error or string, the CLI doubles the placeholder value.

To Reproduce
https://stackblitz.com/edit/node-zrbpxtzw?file=index.js

The code is so short, I'll also put it here:

import { text } from '@clack/prompts';

(async () => {
  const name = await text({
    message: "What's your project name?",
    placeholder: 'my-project',
    validate: () => 'try again',
  });
})();

Steps to reproduce the behavior:

  1. Run the file
  2. Just hit enter when the prompt shows
  3. The prompt errors correctly but fills with double what the placeholder value is

Expected behavior
When the prompt errors out, it should retain whatever value was there already (including none).

Additional Information

Screen.Recording.2025-05-16.at.10.51.54.AM.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions