Skip to content

fix(web): clear prompt when removing Home example chip (#2989)#3045

Open
leno23 wants to merge 1 commit into
nexu-io:mainfrom
leno23:fix/2989-clear-prompt-on-example-chip-remove
Open

fix(web): clear prompt when removing Home example chip (#2989)#3045
leno23 wants to merge 1 commit into
nexu-io:mainfrom
leno23:fix/2989-clear-prompt-on-example-chip-remove

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 26, 2026

/claim #2989

Summary

Removing a selected Home page example prompt chip now also clears the composer input, so the chip and prompt text stay in sync.

Surface area

  • apps/web/src/components/HomeHero.tsxclearSelectedPromptExample() clears both local chip state and the parent prompt via onPromptChange('')
  • apps/web/tests/components/HomeHero.rail.test.tsx — regression test for chip removal

Validation

  • cd apps/web && pnpm test tests/components/HomeHero.rail.test.tsx

Made with Cursor

Removing the selected example prompt chip now also clears the composer
input so chip state stays in sync with the inserted example text.
@lefarcen lefarcen requested a review from PerishCode May 26, 2026 16:39
@lefarcen lefarcen added size/S PR changes 20-100 lines risk/medium Medium risk: regular code changes type/bugfix Bug fix labels May 26, 2026
Copy link
Copy Markdown
Contributor

@lefarcen lefarcen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @leno23! Thanks for picking up the Home example-chip cleanup — the summary makes the chip/input sync issue easy to follow.

A quick coordination note before this goes further: PR #2996 by @xxiaoxiong is already open for #2989, and both PRs touch apps/web/src/components/HomeHero.tsx to clear the prompt when the active example chip is removed. You two may want to compare approaches; the maintainer team will decide which path lands, but I wanted to surface the overlap so neither effort gets wasted.

One PR-body tweak too: could you add the template Surface area checklist and tick UI? Your Summary and Validation already cover the user-facing behavior and test path well; the checklist just helps release review see this touches the Home page interaction.

@github-actions
Copy link
Copy Markdown
Contributor

Visual regression review

Head: d138dd5 · Base: 1d72914

0 changed · 17 unchanged · 0 missing baseline · 0 failed

Unchanged cases
Case Main PR Diff
visual-avatar-menu main pr diff
visual-design-systems main pr diff
visual-home main pr diff
visual-home-catalog main pr diff
visual-home-context-picker main pr diff
visual-home-plugin-filter main pr diff
visual-integrations main pr diff
visual-integrations-use-everywhere main pr diff
visual-new-project-modal main pr diff
visual-plugin-details main pr diff
visual-plugins main pr diff
visual-projects main pr diff
visual-projects-kanban main pr diff
visual-settings-byok main pr diff
visual-settings-execution main pr diff
visual-tasks main pr diff
visual-topbar-execution-switcher main pr diff

Visual diff is advisory only and does not block merging.

Copy link
Copy Markdown
Contributor

@PerishCode PerishCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leno23 thanks for the focused fix and the regression test.

Reviewed apps/web/src/components/HomeHero.tsx and apps/web/tests/components/HomeHero.rail.test.tsx against the changed ranges:

  • clearSelectedPromptExample() clears the composer via onPromptChange('') only when an example chip is active, then drops the chip. That pairs cleanly with the existing onChange guard at lines 827-828 that already nulls the chip when the user edits the prompt away from selectedPromptExample.promptText, so the chip's presence implies the prompt equals the inserted example and wiping it is safe — there is no user-edit text in play to lose.
  • The StatefulHero wrapper in the new test gives the component real state, drives the full pick-then-clear flow through home-hero-prompt-example and .home-hero__active-clear, and asserts both the input value and the chip removal — that is a good regression shape for this bug.

Nice, tight bugfix. Heads up that maintainer @lefarcen flagged overlap with #2996 on the same issue and asked for the Surface area UI checkbox in the PR body; worth syncing with them before merge, but neither is a code concern.

🔁 Powered by Looper · runner=reviewer · agent=claude-code · An autonomous AI dev team for your GitHub repos.

@lefarcen
Copy link
Copy Markdown
Contributor

All gates are green here — flagged this for the maintainer team. Thanks @leno23 for the focused fix and @PerishCode for the review.

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

Labels

risk/medium Medium risk: regular code changes size/S PR changes 20-100 lines type/bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants