Skip to content

feat(code): use Quill Chip for mention chips + PromptInput story#1756

Merged
jonathanlab merged 4 commits intomainfrom
ux/prompt-input-chips
Apr 21, 2026
Merged

feat(code): use Quill Chip for mention chips + PromptInput story#1756
jonathanlab merged 4 commits intomainfrom
ux/prompt-input-chips

Conversation

@adamleithp
Copy link
Copy Markdown
Contributor

@adamleithp adamleithp commented Apr 21, 2026

Summary

  • Replace custom <span>/<button> mention chips with Quill <Chip> component for design system consistency
  • Add icon/close crossfade on left side of each chip — type icon fades to X on hover (150ms ease, respects prefers-reduced-motion)
  • Add selection ring when arrow-keying through chips in the editor
  • Add cursor-pointer only on chips with click actions (github_issue, pastedText), cursor-default on others
  • Add comprehensive PromptInput.stories.tsx with real tiptap editor, real UnifiedModelSelector/ReasoningLevelSelector with mock data
2026-04-21 11 53 11
2026-04-21 11 54 03
2026-04-21 11 55 56
image

Test plan

  • Verify chips render with correct type icons (file, command, github, error, experiment, insight, feature flag)
  • Hover chip — icon fades to X, click X removes chip
  • Arrow keys through chips — selection ring appears
  • GitHub issue chips show cursor-pointer, file/command chips show cursor-default
  • PastedText chips show cursor-pointer and expand on click
  • Run Storybook — all PromptInput stories render correctly
  • Verify no regressions in chip insertion via @ mentions and / commands

🤖 Generated with Claude Code

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 21, 2026

Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/message-editor/components/PromptInput.stories.tsx
Line: 61-69

Comment:
**Chips may be re-inserted on re-render**

`useEffect` runs whenever `chips` reference changes. In Storybook, switching between stories or toggling any control causes a full re-render with a new `chips` array reference, so `insertChip` fires again for each chip already in the editor, producing duplicates. A stable reference (e.g. `useRef` guard or deep-equal comparison) would prevent this.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: revert pastedText interface change,..." | Re-trigger Greptile

Comment on lines +61 to +69
useEffect(() => {
if (!chips?.length) return;
const timer = setTimeout(() => {
for (const chip of chips) {
ref.current?.insertChip(chip);
}
}, 200);
return () => clearTimeout(timer);
}, [chips]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Chips may be re-inserted on re-render

useEffect runs whenever chips reference changes. In Storybook, switching between stories or toggling any control causes a full re-render with a new chips array reference, so insertChip fires again for each chip already in the editor, producing duplicates. A stable reference (e.g. useRef guard or deep-equal comparison) would prevent this.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/message-editor/components/PromptInput.stories.tsx
Line: 61-69

Comment:
**Chips may be re-inserted on re-render**

`useEffect` runs whenever `chips` reference changes. In Storybook, switching between stories or toggling any control causes a full re-render with a new `chips` array reference, so `insertChip` fires again for each chip already in the editor, producing duplicates. A stable reference (e.g. `useRef` guard or deep-equal comparison) would prevent this.

How can I resolve this? If you propose a fix, please make it concise.

@adamleithp adamleithp requested a review from a team April 21, 2026 10:58
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jonathanlab jonathanlab merged commit 9ab98ae into main Apr 21, 2026
15 checks passed
@jonathanlab jonathanlab deleted the ux/prompt-input-chips branch April 21, 2026 11:53
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.

2 participants