-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: add undo feature to reply mails and fix default mail for replies #1980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Conversation
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughAdds reply-context-aware undo-send support and prefill logic. Reply composer initializes fields from localStorage-stored undo data (including deserialized attachments) or computed defaults per mode. The undo hook now accepts a context to store/restore separate data for replies vs. new compose, and updates URL/history accordingly. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant RC as ReplyComposer
participant UH as useUndoSend
participant LS as localStorage
participant H as History/Router
U->>RC: Open reply/replyAll/forward
RC->>LS: Read undoReplyEmailData
LS-->>RC: Undo data + __replyContext
RC->>RC: Validate context, deserialize files, prefill fields
U->>RC: Send
RC->>UH: handleUndoSend(..., emailData, {kind:'reply', threadId, mode, activeReplyId, draftId})
UH->>LS: Store undoReplyEmailData (+__replyContext)
UH->>H: Update URL/history (reply context)
U->>UH: Undo
UH->>RC: Trigger restore flow
RC->>LS: Clear undoReplyEmailData on close
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cubic analysis
1 issue found across 2 files • Review in cubic
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
apps/mail/components/mail/reply-composer.tsx
(6 hunks)apps/mail/hooks/use-undo-send.ts
(3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{css,js,ts,jsx,tsx,mdx}
📄 CodeRabbit Inference Engine (.cursor/rules/tailwind-css-v4.mdc)
**/*.{css,js,ts,jsx,tsx,mdx}
: Chain variants together for composable variants (e.g.,group-has-data-potato:opacity-100
).
Use new variants such asstarting
,not-*
,inert
,nth-*
,in-*
,open
(for:popover-open
), and**
for all descendants.
Do not use deprecated utilities likebg-opacity-*
,text-opacity-*
,border-opacity-*
, anddivide-opacity-*
; use the new syntax (e.g.,bg-black/50
).
Use renamed utilities:shadow-sm
is nowshadow-xs
,shadow
is nowshadow-sm
,drop-shadow-sm
is nowdrop-shadow-xs
,drop-shadow
is nowdrop-shadow-sm
,blur-sm
is nowblur-xs
,blur
is nowblur-sm
,rounded-sm
is nowrounded-xs
,rounded
is nowrounded-sm
,outline-none
is nowoutline-hidden
.
Usebg-(--brand-color)
syntax for CSS variables in arbitrary values instead ofbg-[--brand-color]
.
Stacked variants now apply left-to-right instead of right-to-left.
Files:
apps/mail/hooks/use-undo-send.ts
apps/mail/components/mail/reply-composer.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (AGENT.md)
**/*.{js,jsx,ts,tsx}
: Use 2-space indentation
Use single quotes
Limit lines to 100 characters
Semicolons are required
Files:
apps/mail/hooks/use-undo-send.ts
apps/mail/components/mail/reply-composer.tsx
**/*.{js,jsx,ts,tsx,css}
📄 CodeRabbit Inference Engine (AGENT.md)
Use Prettier with sort-imports and Tailwind plugins
Files:
apps/mail/hooks/use-undo-send.ts
apps/mail/components/mail/reply-composer.tsx
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (AGENT.md)
Enable TypeScript strict mode
Files:
apps/mail/hooks/use-undo-send.ts
apps/mail/components/mail/reply-composer.tsx
🧠 Learnings (1)
📓 Common learnings
Learnt from: retrogtx
PR: Mail-0/Zero#1573
File: apps/mail/components/create/template-button.tsx:197-216
Timestamp: 2025-07-28T05:37:50.566Z
Learning: retrogtx prefers less nitpicky code review suggestions and may dismiss detailed accessibility/best practice recommendations with casual responses like "bro please".
🧬 Code Graph Analysis (2)
apps/mail/hooks/use-undo-send.ts (1)
apps/server/src/lib/schemas.ts (1)
UserSettings
(118-118)
apps/mail/components/mail/reply-composer.tsx (3)
apps/mail/hooks/use-undo-send.ts (2)
EmailData
(8-17)deserializeFiles
(60-69)apps/server/src/lib/schemas.ts (1)
deserializeFiles
(11-23)apps/mail/lib/schemas.ts (1)
deserializeFiles
(34-46)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
apps/mail/components/mail/reply-composer.tsx (1)
59-62
: Gate undo data by mode too, not just thread/reply id.Prevents restoring a reply-all payload into a plain reply (or vice versa). Simple guard, less surprise.
- const matches = !!ctx && ctx.threadId === currentThread && ctx.activeReplyId === currentReply; + const matches = + !!ctx && + ctx.threadId === currentThread && + ctx.activeReplyId === currentReply && + ctx.mode === mode;
Summary by cubic
Added undo send support for reply emails and fixed default recipient and subject selection when replying.
New Features
Bug Fixes
Summary by CodeRabbit
New Features
Bug Fixes