fix: Trigger refetch() after label creation toast completes#1889
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Bug Report
Comments? Email us. |
WalkthroughA Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant NavMain Component
participant Toast
participant Label API
User->>NavMain Component: Submit new label
NavMain Component->>Toast: Show toast (promise)
Toast->>Label API: Create label
Label API-->>Toast: Success or Failure
Toast->>NavMain Component: finally callback
NavMain Component->>NavMain Component: refetch labels
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Assessment against linked issues
Suggested labels
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (3)**/*.{js,jsx,ts,tsx}📄 CodeRabbit Inference Engine (AGENT.md)
Files:
**/*.{js,jsx,ts,tsx,css}📄 CodeRabbit Inference Engine (AGENT.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit Inference Engine (AGENT.md)
Files:
🧠 Learnings (5)📓 Common learnings📚 Learning: in draft deletion operations, using settimeout with a delay (like 500ms) before showing success toas...Applied to files:
📚 Learning: in apps/server/src/lib/driver/google.ts, the normalization of "draft" to "drafts" in the count() met...Applied to files:
📚 Learning: in the threadlabels prompt system, existing labels should not be automatically preserved. the ai age...Applied to files:
📚 Learning: in apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchcategorybyindex function using hardcoded i...Applied to files:
✨ 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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
cubic analysis
1 issue found across 1 file • 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.
Bug Report
Comments? Email us. |
Bug Report
Comments? Email us. |
Description
Fixes #1748 and #1687
Ensures refetch() is called after label creation by using Sonner’s finally callback in toast.promise to update ui state without manual reload.
Type of Change
Please delete options that are not relevant.
Areas Affected
Please check all that apply:
Testing Done
Describe the tests you've done:
Security Considerations
For changes involving data or authentication:
Checklist
Additional Notes
Add any other context about the pull request here.
Screenshots/Recordings
Before (labels are not visible after creation)
cursorful-video-1754126244395.mp4
After
cursorful-video-1754126609359.mp4
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.
Summary by cubic
Fixed label list not updating after creating a new label by triggering refetch() once the creation toast completes. This ensures the label list always shows the latest changes.
Summary by CodeRabbit