Skip to content

Fix Contribution Goals Sync with MongoDB#8279

Open
kanishka-2007-tech wants to merge 4 commits into
JhaSourav07:mainfrom
kanishka-2007-tech:bug-goaltracker
Open

Fix Contribution Goals Sync with MongoDB#8279
kanishka-2007-tech wants to merge 4 commits into
JhaSourav07:mainfrom
kanishka-2007-tech:bug-goaltracker

Conversation

@kanishka-2007-tech

@kanishka-2007-tech kanishka-2007-tech commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@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.

@retenta-bot

retenta-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

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!

@retenta-bot retenta-bot Bot changed the title bug(goal-tracker): sync contribution goals with MongoDB instead of localStorage Fix Contribution Goals Sync with MongoDB Jul 23, 2026
@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:feature New features, additions, or enhancements mentor:Aamod007 labels Jul 23, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Hey @kanishka-2007-tech, the CI Pipeline is failing on this PR and it has been marked as status:blocked.

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 passes

2. Auto-fix common issues:

npm run format         # Auto-fix formatting with Prettier
npm run lint -- --fix  # Auto-fix lint errors where possible

3. Check the full failure log here:
👉 View CI Run

Once you push a fix and the CI passes, the status:blocked label will be removed automatically. 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. status:blocked This PR is blocked due to a failing CI check. type:feature New features, additions, or enhancements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: GoalTracker goals are stored only in localStorage and don't sync across devices

2 participants