fix(web): clear prompt when removing Home example chip (#2989)#3045
fix(web): clear prompt when removing Home example chip (#2989)#3045leno23 wants to merge 1 commit into
Conversation
Removing the selected example prompt chip now also clears the composer input so chip state stays in sync with the inserted example text.
lefarcen
left a comment
There was a problem hiding this comment.
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.
PerishCode
left a comment
There was a problem hiding this comment.
@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 viaonPromptChange('')only when an example chip is active, then drops the chip. That pairs cleanly with the existingonChangeguard at lines 827-828 that already nulls the chip when the user edits the prompt away fromselectedPromptExample.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
StatefulHerowrapper in the new test gives the component real state, drives the full pick-then-clear flow throughhome-hero-prompt-exampleand.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.
|
All gates are green here — flagged this for the maintainer team. Thanks @leno23 for the focused fix and @PerishCode for the review. |
















































/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.tsx—clearSelectedPromptExample()clears both local chip state and the parent prompt viaonPromptChange('')apps/web/tests/components/HomeHero.rail.test.tsx— regression test for chip removalValidation
cd apps/web && pnpm test tests/components/HomeHero.rail.test.tsxMade with Cursor