feat(dashboard): persist GoalTracker goals in MongoDB for cross-device synchronization - #8414
feat(dashboard): persist GoalTracker goals in MongoDB for cross-device synchronization#8414kanishka-2007-tech wants to merge 1 commit into
Conversation
|
@kanishka-2007-tech is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
This pull request addresses the critical issue of user goals being lost when switching devices or clearing browser storage by implementing server-side persistence with MongoDB. This aligns with previous decisions made to sync contribution goals with MongoDB, ensuring a seamless user experience. Thank you for your contribution, and I look forward to your updates! |
📦 Next.js Bundle Size Report (Gzipped Sizes)
📊 Summary of Totals
|
Aamod007
left a comment
There was a problem hiding this comment.
The MongoDB persistence layer for GoalTracker goals is well-architected — clean API routes with proper validation (parseGoals with range checks), CSRF protection, and graceful fallback when MONGODB_URI is unset. The GoalTracker component's sync logic with server round-trip is sound.
CI is failing though. Please check the logs and push fixes so we can proceed.
Labels: level:intermediate (3 files, API+model+component changes), quality:clean, type:feature, mentor:Aamod007
Aamod007
left a comment
There was a problem hiding this comment.
Re-reviewing after noting the only CI failure is Vercel authorization (not code-related). All other checks (Format · Lint · Typecheck · Test, Production Build, CodeQL) pass. Approving — the Vercel deploy auth is a repo-level config issue, not a code problem.
Description
This PR migrates GoalTracker persistence from browser-only localStorage to the existing server-side user storage.
Previously, monthly and yearly contribution goals were stored exclusively using useLocalStorage. As a result, users would lose their goals when:
Switching to a different device
Using another browser
Clearing browser storage
Opening the dashboard in private/incognito mode
Since users are already identified by their GitHub username and the project already includes a MongoDB-backed User model, goals are now synchronized with the user's account, ensuring they persist across sessions and devices.
Fixes #8276
Pillar
Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).feat(themes): ...,fix(calculate): ...).README.mdif I added a new theme or URL parameter.