Conversation
- Improved formatting and readability in ConversationEdit component. - Added title handling logic to ensure it syncs with conversation data. - Enhanced query invalidation in ProjectConversationOverview after mutation success to keep data consistent. - Minor adjustments to component imports for better organization.
WalkthroughUpdates adjust form synchronization and cache invalidation around conversations: minor formatting and payload ordering in ConversationEdit, a useEffect to keep form title in sync when not dirty, a duration display tweak, and expanded post-mutation cache invalidation to include project-level conversations. LGTM. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@echo/frontend/src/components/conversation/ConversationEdit.tsx`:
- Around line 195-203: The effect that syncs conversation.title only runs for
truthy titles, so if the backend sends null/"" while the field is clean the
input stays stale; update the useEffect (the block using conversation.title,
formState.dirtyFields.title, getValues, and setValue) to remove the truthy guard
and instead check only that the title field is not dirty and getValues("title")
!== conversation.title, then call setValue("title", conversation.title ?? "", {
shouldDirty: false }) so null/empty backend titles overwrite the input.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: ffd77229-4581-40bc-8b12-f78588d60077
📒 Files selected for processing (2)
echo/frontend/src/components/conversation/ConversationEdit.tsxecho/frontend/src/routes/project/conversation/ProjectConversationOverview.tsx
- Simplified the title handling logic to use a default empty string when the conversation title is not available. - Improved readability by reducing nested conditions in the useEffect hook.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
echo/frontend/src/components/conversation/ConversationEdit.tsx (2)
157-163:⚠️ Potential issue | 🟡 MinorTrim whitespace-only titles before persisting.
data.title || nulltreats" "as a real title, so blank-looking titles can be saved; if the backend preserves that whitespace,hasTitlestays truthy and the Generate CTA remains hidden. Normalize withdata.title.trim() || nullbefore building the mutation payload.Suggested fix
onSave: async (data: ConversationEditFormValues) => { + const title = data.title.trim(); await updateConversationMutation.mutateAsync({ id: conversation.id, payload: { participant_name: data.participant_name, - title: data.title || null, + title: title || null, }, });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@echo/frontend/src/components/conversation/ConversationEdit.tsx` around lines 157 - 163, In onSave inside ConversationEdit.tsx (the handler using ConversationEditFormValues and calling updateConversationMutation.mutateAsync), normalize the title by trimming whitespace before building the payload: compute a trimmedTitle = data.title?.trim() and pass title: trimmedTitle || null (instead of data.title || null) so whitespace-only titles are treated as null; leave participant_name unchanged.
176-193:⚠️ Potential issue | 🟠 MajorSurface generate-title failures inline.
This mutation only handles success, so a failed Generate click goes silent. Add toast + contextual
CloseableAlert/Alertnear the title field offgenerateTitleMutation.isError.As per coding guidelines "Surface UI mutations with inline feedback: pair toasts with contextual Mantine
Alertcomponents inside modals/forms for errors or warnings".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@echo/frontend/src/components/conversation/ConversationEdit.tsx` around lines 176 - 193, The generate-title mutation currently only handles onSuccess and leaves failures silent; update useMutation (generateTitleMutation) to handle onError by showing a toast with the error message and expose generateTitleMutation.isError so the ConversationEdit component can render a contextual CloseableAlert/Alert next to the title field that displays the mutation error (use the error returned from generateConversationTitle). Keep the existing onSuccess behavior (setValue and queryClient.invalidateQueries) and ensure the alert is conditionally rendered based on generateTitleMutation.isError and cleared when the user dismisses it or when a successful mutation occurs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@echo/frontend/src/components/conversation/ConversationEdit.tsx`:
- Around line 157-163: In onSave inside ConversationEdit.tsx (the handler using
ConversationEditFormValues and calling updateConversationMutation.mutateAsync),
normalize the title by trimming whitespace before building the payload: compute
a trimmedTitle = data.title?.trim() and pass title: trimmedTitle || null
(instead of data.title || null) so whitespace-only titles are treated as null;
leave participant_name unchanged.
- Around line 176-193: The generate-title mutation currently only handles
onSuccess and leaves failures silent; update useMutation (generateTitleMutation)
to handle onError by showing a toast with the error message and expose
generateTitleMutation.isError so the ConversationEdit component can render a
contextual CloseableAlert/Alert next to the title field that displays the
mutation error (use the error returned from generateConversationTitle). Keep the
existing onSuccess behavior (setValue and queryClient.invalidateQueries) and
ensure the alert is conditionally rendered based on
generateTitleMutation.isError and cleared when the user dismisses it or when a
successful mutation occurs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0da1a5d0-2a2b-4282-bdc3-adaa5d85f6a2
📒 Files selected for processing (1)
echo/frontend/src/components/conversation/ConversationEdit.tsx
Summary by CodeRabbit
Bug Fixes
Style
Refactoring