Skip to content

fix(prompts): render falsy options in limitOptions - #628

Open
imharjot wants to merge 1 commit into
bombshell-dev:mainfrom
imharjot:fix/limit-options-falsy-values
Open

imharjot wants to merge 1 commit into
bombshell-dev:mainfrom
imharjot:fix/limit-options-falsy-values

Conversation

@imharjot

@imharjot imharjot commented Oct 23, 2026 •

Copy link
Copy Markdown

What does this PR do?

limitOptions accepts primitive options, but its truthiness check skips the style callback for 0, false, and ''. Those options become blank rows, including when the cursor is on them.

Check for undefined instead so these values reach the existing formatter. The regression covers the rendered labels and the active option. This is a narrow fix to the exported helper, so I haven't opened a separate issue.

For [0, false, '', 1], with a formatter that adds brackets and marks the active row, the output changes from ['', '', '', '[1]'] to ['[0]', '> [false]', '[]', '[1]'].

Type of change

  • Bug fix

Validation

  • The new regression fails on unchanged main (1835f415) and passes with the fix. The built package reproduces the same before/after result.
  • Node 24.22.1, pnpm 10.33.0, TERM=xterm-256color: pnpm test passes all 798 tests, including the package build. pnpm types, pnpm format, pnpm lint, and pnpm deps pass.
  • On the guide's Node 20.18.1 pin, all 15 limitOptions tests pass. Four existing note color snapshots fail identically on unchanged main; no snapshots or assertions were changed.

GitHub CI and the preview are awaiting first-contributor workflow approval. The separate Detect Agent run failed while installing the shared automation repository (npm install --prefix automation: Cannot read properties of null (reading 'edgesOut')), before detection ran.

Checklist

  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@changeset-bot

changeset-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8055841

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant