Don't toggle off to reply when disabling drafting#844
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughEdits adjust rule update and draft-replies enablement logic: targeted revalidation, explicit rule fetch with actions, conditional creation when missing, and early no-op when disabling absent rules. UI file removes comments without logic changes. Version bumped from v2.16.2 to v2.16.3. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI
participant Actions as rule.ts
participant Store as Rule Store/DB
participant Cache as Cache/Paths
rect rgb(240,248,255)
note over UI,Actions: enableDraftRepliesAction
UI->>Actions: enableDraftReplies(emailAccountId, enable)
Actions->>Store: getRule(emailAccountId, systemType=TO_REPLY, include actions)
alt Rule exists?
alt enable == true
opt DRAFT_EMAIL action missing
Actions->>Store: add DRAFT_EMAIL action
end
Actions->>Cache: revalidate reply-zero path (targeted)
else enable == false
opt DRAFT_EMAIL action present
Actions->>Store: remove DRAFT_EMAIL action
end
Actions->>Cache: revalidate reply-zero path (targeted)
end
else Rule missing
alt enable == true
Actions->>Store: create TO_REPLY rule with DRAFT_EMAIL action
Actions->>Cache: revalidate reply-zero path
else enable == false
note right of Actions: No-op
end
end
end
sequenceDiagram
autonumber
participant Caller
participant Actions as updateRuleAction
participant Store as Rule Store/DB
participant Cache as Cache/Paths
Caller->>Actions: updateRule(ruleId, payload)
Actions->>Store: fetch current rule
Actions->>Actions: compute actions to delete/update/create
par Apply diffs
Actions->>Store: delete actions
Actions->>Store: update actions
Actions->>Store: create actions
end
Actions->>Cache: revalidate path for updated rule only
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used📓 Path-based instructions (19)!{.cursor/rules/*.mdc}📄 CodeRabbit inference engine (.cursor/rules/cursor-rules.mdc)
Files:
!pages/_document.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
apps/web/**/*.{ts,tsx}📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
apps/web/utils/actions/**/*.ts📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
**/*.ts📄 CodeRabbit inference engine (.cursor/rules/form-handling.mdc)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)
Files:
apps/web/utils/actions/*.ts📄 CodeRabbit inference engine (.cursor/rules/server-actions.mdc)
Files:
apps/web/utils/**📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Files:
apps/web/utils/**/*.ts📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
apps/web/app/**📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
apps/web/**/*.tsx📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/form-handling.mdc)
Files:
apps/web/app/(app)/*/**📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
Files:
apps/web/app/(app)/*/**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
Files:
apps/web/app/(app)/*/**/**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
Files:
apps/web/app/**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Files:
**/*.{jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
**/*.{html,jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
|
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="apps/web/utils/actions/rule.ts">
<violation number="1" location="apps/web/utils/actions/rule.ts:260">
`rule = rule || …` short-circuits for existing rules, so `toggleRule` never runs and the enabled flag is never updated; enabling/disabling drafting silently fails.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
Summary by CodeRabbit
Bug Fixes
Chores