Skip to content

fix: functional labels picker in new issue dialog + popover click fix#1936

Open
apsisvictor-sys wants to merge 1 commit intopaperclipai:masterfrom
apsisvictor-sys:fix/issue-labels-picker
Open

fix: functional labels picker in new issue dialog + popover click fix#1936
apsisvictor-sys wants to merge 1 commit intopaperclipai:masterfrom
apsisvictor-sys:fix/issue-labels-picker

Conversation

@apsisvictor-sys
Copy link
Copy Markdown

Summary

  • New issue dialog: labels picker — Replaces the placeholder "Labels" button with a fully functional label selector. Users can now search labels, toggle multi-select, and see selected labels with their color indicators directly on the issue creation form. Selected label IDs are included in the create issue payload via labelIds.

  • IssueProperties popover click fix — The PropertyPicker popover trigger button was missing an explicit onClick handler, relying solely on Radix's asChild prop merging. This caused the popover to not toggle reliably in some cases. Added explicit onClick={() => onOpenChange(!open)} to the trigger button.

Test plan

  • Open new issue dialog → verify Labels button shows searchable dropdown
  • Select multiple labels → verify they appear as colored chips on the button
  • Create issue with labels → verify labelIds is sent in the request payload
  • Open issue properties → verify popover toggles correctly on click

🤖 Generated with Claude Code

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 27, 2026

Greptile Summary

This PR replaces the placeholder "Labels" button in the new-issue dialog with a fully functional labels picker (search, multi-select, colour chips, labelIds in the create payload), and adds an explicit onClick handler to the PropertyPicker popover trigger in IssueProperties.tsx to ensure reliable toggling.\n\n- IssueProperties.tsx — The onClick fix is straightforward and safe.\n- NewIssueDialog.tsx — Two bugs were found:\n 1. selectedLabelIds is never reset in the "restore/reset on open" effect, so previously selected labels bleed into the next dialog session.\n 2. The "No labels defined." empty-state message relies on (labels ?? []).length === 0 — the total unfiltered count — so it never appears when a search term matches zero labels, leaving the user with a blank dropdown and no feedback.\n- The PR description is missing the "thinking path" and the detailed sections (what you did, why it matters, how to verify, risks) required by CONTRIBUTING.md. Since this is a visible UI change, before/after screenshots should also be included.

Confidence Score: 4/5

Two P1 bugs in NewIssueDialog.tsx (stale label state on re-open and broken empty-state UX) should be fixed before merging.

The IssueProperties.tsx change is safe. The NewIssueDialog.tsx change has two concrete defects: selected labels persist across dialog sessions (wrong data submitted), and the search empty-state message never surfaces when no results match (broken UX on the new code path). Both are straightforward fixes.

ui/src/components/NewIssueDialog.tsx — label reset on dialog open (line ~519) and empty-state condition (line 1444).

Important Files Changed

Filename Overview
ui/src/components/NewIssueDialog.tsx Adds functional labels picker with search, multi-select, and API integration — two bugs found: selectedLabelIds is never reset when the dialog re-opens, and the empty-state message is hidden when a search has no matches.
ui/src/components/IssueProperties.tsx Adds explicit onClick={() => onOpenChange(!open)} to the PopoverTrigger child button to guarantee reliable toggle behaviour; no issues found.

Comments Outside Diff (1)

  1. ui/src/components/NewIssueDialog.tsx, line 517-577 (link)

    P1 selectedLabelIds not reset on dialog open

    The useEffect that restores/resets form state when the dialog opens (triggered by newIssueOpen) resets every other field (setTitle, setStatus, setPriority, setAssigneeValue, etc.) but never calls setSelectedLabelIds([]). This means selected labels persist across dialog sessions: open the dialog, pick a few labels, close (or submit), then open the dialog again — the previously selected labels are still shown and will be included in the next issue creation payload.

    Add a reset for selectedLabelIds inside this effect in each branch (or once at the top, since the early-return guard means the effect only runs when the dialog opens):

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: ui/src/components/NewIssueDialog.tsx
    Line: 517-577
    
    Comment:
    **`selectedLabelIds` not reset on dialog open**
    
    The `useEffect` that restores/resets form state when the dialog opens (triggered by `newIssueOpen`) resets every other field (`setTitle`, `setStatus`, `setPriority`, `setAssigneeValue`, etc.) but never calls `setSelectedLabelIds([])`. This means selected labels persist across dialog sessions: open the dialog, pick a few labels, close (or submit), then open the dialog again — the previously selected labels are still shown and will be included in the next issue creation payload.
    
    Add a reset for `selectedLabelIds` inside this effect in each branch (or once at the top, since the early-return guard means the effect only runs when the dialog opens):
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: ui/src/components/NewIssueDialog.tsx
Line: 517-577

Comment:
**`selectedLabelIds` not reset on dialog open**

The `useEffect` that restores/resets form state when the dialog opens (triggered by `newIssueOpen`) resets every other field (`setTitle`, `setStatus`, `setPriority`, `setAssigneeValue`, etc.) but never calls `setSelectedLabelIds([])`. This means selected labels persist across dialog sessions: open the dialog, pick a few labels, close (or submit), then open the dialog again — the previously selected labels are still shown and will be included in the next issue creation payload.

Add a reset for `selectedLabelIds` inside this effect in each branch (or once at the top, since the early-return guard means the effect only runs when the dialog opens):

```suggestion
  useEffect(() => {
    if (!newIssueOpen) return;
    setDialogCompanyId(selectedCompanyId);
    executionWorkspaceDefaultProjectId.current = null;
    setSelectedLabelIds([]);
```

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

---

This is a comment left during a code review.
Path: ui/src/components/NewIssueDialog.tsx
Line: 1444-1446

Comment:
**Empty-state message never shows when search has no matches**

The empty-state check `(labels ?? []).length === 0` tests whether the *unfiltered* label list is empty. When the user types a search term that matches no labels, the filtered `.map(...)` above renders nothing — but this condition is still false (e.g. there are 5 labels, just none matching the search), so the user sees a completely blank dropdown with no feedback.

The guard should compare against the *filtered* list:

```suggestion
                {(labels ?? [])
                  .filter((l) => !labelSearch.trim() || l.name.toLowerCase().includes(labelSearch.toLowerCase()))
                  .length === 0 && (
                  <p className="px-2 py-2 text-xs text-muted-foreground">
                    {labelSearch.trim() ? "No labels found." : "No labels defined."}
                  </p>
                )}
```

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

Reviews (1): Last reviewed commit: "fix: issue properties display and new is..." | Re-trigger Greptile

Comment on lines +1444 to +1446
{(labels ?? []).length === 0 && (
<p className="px-2 py-2 text-xs text-muted-foreground">No labels defined.</p>
)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Empty-state message never shows when search has no matches

The empty-state check (labels ?? []).length === 0 tests whether the unfiltered label list is empty. When the user types a search term that matches no labels, the filtered .map(...) above renders nothing — but this condition is still false (e.g. there are 5 labels, just none matching the search), so the user sees a completely blank dropdown with no feedback.

The guard should compare against the filtered list:

Suggested change
{(labels ?? []).length === 0 && (
<p className="px-2 py-2 text-xs text-muted-foreground">No labels defined.</p>
)}
{(labels ?? [])
.filter((l) => !labelSearch.trim() || l.name.toLowerCase().includes(labelSearch.toLowerCase()))
.length === 0 && (
<p className="px-2 py-2 text-xs text-muted-foreground">
{labelSearch.trim() ? "No labels found." : "No labels defined."}
</p>
)}
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/components/NewIssueDialog.tsx
Line: 1444-1446

Comment:
**Empty-state message never shows when search has no matches**

The empty-state check `(labels ?? []).length === 0` tests whether the *unfiltered* label list is empty. When the user types a search term that matches no labels, the filtered `.map(...)` above renders nothing — but this condition is still false (e.g. there are 5 labels, just none matching the search), so the user sees a completely blank dropdown with no feedback.

The guard should compare against the *filtered* list:

```suggestion
                {(labels ?? [])
                  .filter((l) => !labelSearch.trim() || l.name.toLowerCase().includes(labelSearch.toLowerCase()))
                  .length === 0 && (
                  <p className="px-2 py-2 text-xs text-muted-foreground">
                    {labelSearch.trim() ? "No labels found." : "No labels defined."}
                  </p>
                )}
```

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

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