Fix Contribution Goals Sync with MongoDB#8279
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 PR addresses a critical issue by moving contribution goals from localStorage to MongoDB, enhancing user experience across devices. This aligns with previous decisions made to improve code quality and functionality, such as fixing dead code in the calculateStreak function to ensure accurate streak status. Thank you for your contribution! |
Aamod007
left a comment
There was a problem hiding this comment.
This is a fantastic addition! Syncing the contribution goals with MongoDB so they persist across devices is exactly what this feature needed.
The code looks clean, the API integration handles aborts gracefully, and the skeleton loader prevents layout shift. Great job!
Label Justification:
- \level:intermediate: Full-stack implementation requiring API route creation, MongoDB schema updates, and frontend React lifecycle management.
- \quality:clean: Excellent error handling and UI state management.
- \ ype:feature: Adds persistent database syncing for a user-facing feature.
- \mentor:Aamod007: Assigned as required.
|
🚨 Hey @kanishka-2007-tech, the CI Pipeline is failing on this PR and it has been marked as Please fix the issues before this can be reviewed. Here's how: 1. Run checks locally before pushing: npm run format:check # Check Prettier formatting
npm run lint # Run ESLint
npm run typecheck # TypeScript type check
npm run test # Run unit tests (Vitest)
npm run build # Verify production build passes2. Auto-fix common issues: npm run format # Auto-fix formatting with Prettier
npm run lint -- --fix # Auto-fix lint errors where possible3. Check the full failure log here: Once you push a fix and the CI passes, the |
f4054b7 to
ce22f5a
Compare
Description
This PR fixes an issue where the GoalTracker stores monthly and yearly contribution goals only in localStorage, causing user preferences to be lost when switching devices, clearing browser data, or using private browsing.
The new implementation persists goals in the existing MongoDB-backed User model while preserving the current UI behavior. Goals are now automatically synchronized across devices for authenticated users.
This PR introduces server-side persistence for contribution goals.
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.