Night Shift: fix timeout memory leaks in dashboard#15
Conversation
Fix two uncleaned setTimeout calls in the dashboard that could cause state updates on unmounted components: 1. Migration modal timeout (500ms) now has proper cleanup 2. Goals initialization retry now uses a ref for cleanup on unmount, caps retries at 3 with increasing backoff (was unbounded/recursive) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
✨ 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 |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| const timer = setTimeout(() => { | ||
| setIsMigrationModalOpen(true); | ||
| }, 500); | ||
| return () => clearTimeout(timer); |
There was a problem hiding this comment.
Migration timer cleared before it can fire
Medium Severity
The cleanup returned from the migration useEffect clears the setTimeout created for opening the modal, but the same effect also calls setMigrationChecked(true). That state change re-runs the effect immediately, so the previous cleanup runs and cancels the timer in dashboard.tsx before setIsMigrationModalOpen(true) executes.
Additional Locations (2)
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||


User description
Automated improvement by GolemsZikaron Night Shift.
fix timeout memory leaks in dashboard
PR Type
Bug fix
Description
Fix uncleaned setTimeout in migration modal causing memory leaks
Add proper cleanup for goals initialization retry logic
Cap goals retry attempts at 3 with exponential backoff
Prevent state updates on unmounted components
Diagram Walkthrough
File Walkthrough
dashboard.tsx
Fix memory leaks from uncleaned timeoutssrc/routes/_authed/dashboard.tsx
useRefimport for tracking retry stategoalsRetryRefto track retry count and timer IDattempts