feat(code): suggest PR work items on new task page#2553
Conversation
|
React Doctor found 2 issues in 2 files · 2 warnings. 2 warnings
Reviewed by React Doctor for commit |
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/code/src/shared/types/analytics.ts:908
**Duplicate type definition**
`WorkItemKind` here (`"review" | "ci" | "conflict"`) is identical to `PrWorkItemKind` already exported from `@main/services/git/schemas`. Defining the same union twice means any future change to the work-item kinds must be applied in two places. The analytics properties could instead import and reuse `PrWorkItemKind` directly, as `SuggestedTasksPanel.tsx` already imports from that path.
### Issue 2 of 2
apps/code/src/renderer/features/task-detail/components/SuggestedTasksPanel.tsx:181-184
**Unguarded Set construction in render body**
`dismissed` and `workItems` are recomputed (allocating a new `Set` and array) on every render, even when `dismissedWorkItemKeys` and `workItemsRaw` haven't changed. Wrapping both in a `useMemo` (dependencies: `dismissedWorkItemKeys`, `workItemsRaw`, `selectedDirectory`) would avoid churning downstream derived state on unrelated re-renders.
Reviews (1): Last reviewed commit: "feat(code): suggest PR work items on new..." | Re-trigger Greptile |
| [ANALYTICS_EVENTS.SETUP_TASK_SELECTED]: SetupTaskSelectedProperties; | ||
| [ANALYTICS_EVENTS.SETUP_TASK_DISMISSED]: SetupTaskDismissedProperties; | ||
| [ANALYTICS_EVENTS.SETUP_WORK_ITEM_SELECTED]: SetupWorkItemSelectedProperties; | ||
| [ANALYTICS_EVENTS.SETUP_WORK_ITEM_DISMISSED]: SetupWorkItemDismissedProperties; |
There was a problem hiding this comment.
WorkItemKind here ("review" | "ci" | "conflict") is identical to PrWorkItemKind already exported from @main/services/git/schemas. Defining the same union twice means any future change to the work-item kinds must be applied in two places. The analytics properties could instead import and reuse PrWorkItemKind directly, as SuggestedTasksPanel.tsx already imports from that path.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/shared/types/analytics.ts
Line: 908
Comment:
**Duplicate type definition**
`WorkItemKind` here (`"review" | "ci" | "conflict"`) is identical to `PrWorkItemKind` already exported from `@main/services/git/schemas`. Defining the same union twice means any future change to the work-item kinds must be applied in two places. The analytics properties could instead import and reuse `PrWorkItemKind` directly, as `SuggestedTasksPanel.tsx` already imports from that path.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| const dismissed = new Set(dismissedWorkItemKeys); | ||
| const workItems = workItemsRaw.filter( | ||
| (item) => !dismissed.has(dismissedWorkItemKey(selectedDirectory, item)), | ||
| ); |
There was a problem hiding this comment.
Unguarded Set construction in render body
dismissed and workItems are recomputed (allocating a new Set and array) on every render, even when dismissedWorkItemKeys and workItemsRaw haven't changed. Wrapping both in a useMemo (dependencies: dismissedWorkItemKeys, workItemsRaw, selectedDirectory) would avoid churning downstream derived state on unrelated re-renders.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/task-detail/components/SuggestedTasksPanel.tsx
Line: 181-184
Comment:
**Unguarded Set construction in render body**
`dismissed` and `workItems` are recomputed (allocating a new `Set` and array) on every render, even when `dismissedWorkItemKeys` and `workItemsRaw` haven't changed. Wrapping both in a `useMemo` (dependencies: `dismissedWorkItemKeys`, `workItemsRaw`, `selectedDirectory`) would avoid churning downstream derived state on unrelated re-renders.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Problem
the new task page is effectively an empty text box
this is fine long-term or for existing users, but hurts new user activation imo
Changes
adds "PR work items" as suggestions below the input box. things like:
clicking a suggestion enters a prompt so the agent can help you get started
How did you test this?
manually
Automatic notifications