fix(tasks): conversation rename#2107
Conversation
jschwxrz
commented
May 19, 2026
- fixes conversation rename failing from the right sidebar
- delays entering inline rename mode until the context menu has fully closed
- selects the rename input via callback ref when it mounts
Greptile SummaryThis PR fixes conversation rename from the right sidebar by introducing a two-phase approach: clicking "Rename" sets a pending flag, and the inline edit input only mounts after the context menu's close animation fully completes via
Confidence Score: 4/5Safe to merge — the deferred rename approach is logically correct and onOpenChangeComplete is a supported base-ui prop. The core fix is sound: pendingRenameRef correctly tracks intent across the close animation, and onOpenChangeComplete on @base-ui/react ContextMenu Root is a documented, typed callback that fires after close animations finish. The only observation is that handleRename and handleContextMenuOpenChangeComplete are not wrapped in useCallback while handleRenameInputRef is, creating a minor inconsistency in an observer component. No functional bugs were found. No files require special attention — the single changed file is straightforward and well-scoped.
|
| Filename | Overview |
|---|---|
| src/renderer/features/tasks/conversations/sidebar-conversations-list.tsx | Introduces pendingRenameRef and onOpenChangeComplete to defer rename mode until the context menu animation completes; replaces autoFocus with a callback ref. Logic is correct; minor inconsistency in that handleRename/handleContextMenuOpenChangeComplete are not memoized while handleRenameInputRef is. |
Sequence Diagram
sequenceDiagram
participant User
participant ContextMenu
participant ConversationRow
participant RenameInput
User->>ContextMenu: Right-click (open menu)
User->>ContextMenu: Click "Rename"
ContextMenu->>ConversationRow: handleRename()
Note over ConversationRow: pendingRenameRef.current = true
ContextMenu->>ContextMenu: Begin close animation
ContextMenu->>ConversationRow: onOpenChangeComplete(false)
Note over ConversationRow: pendingRenameRef.current = false, setIsEditing(true)
ConversationRow->>RenameInput: Mount input element
RenameInput->>RenameInput: handleRenameInputRef(input) focus() + select()
User->>RenameInput: Type new name / press Enter
RenameInput->>ConversationRow: handleRenameSubmit(newTitle)
ConversationRow->>ConversationRow: setIsEditing(false)
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
src/renderer/features/tasks/conversations/sidebar-conversations-list.tsx:62-71
`handleRename` and `handleContextMenuOpenChangeComplete` are recreated on every render, while `handleRenameInputRef` is memoized. Because `ConversationRow` is a MobX `observer`, any observed state change triggers a re-render and produces new function references. `handleContextMenuOpenChangeComplete` is forwarded directly to `ContextMenu` as `onOpenChangeComplete`, so wrapping both in `useCallback` keeps the pattern consistent and avoids unnecessary prop churn on the base-ui primitive.
```suggestion
const handleRename = useCallback(() => {
pendingRenameRef.current = true;
}, []);
const handleContextMenuOpenChangeComplete = useCallback((open: boolean) => {
if (!open && pendingRenameRef.current) {
pendingRenameRef.current = false;
setIsEditing(true);
}
}, []);
```
Reviews (1): Last reviewed commit: "fix(tasks): delay conversation rename ed..." | Re-trigger Greptile
15581f7 to
2d50741
Compare