Skip to content

feat(dashboard): persist GoalTracker goals in MongoDB for cross-device synchronization - #8414

Open
kanishka-2007-tech wants to merge 1 commit into
JhaSourav07:mainfrom
kanishka-2007-tech:trackgoal
Open

feat(dashboard): persist GoalTracker goals in MongoDB for cross-device synchronization#8414
kanishka-2007-tech wants to merge 1 commit into
JhaSourav07:mainfrom
kanishka-2007-tech:trackgoal

Conversation

@kanishka-2007-tech

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

Copy link
Copy Markdown
Contributor

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

  • 📐 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 27, 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 27, 2026

Copy link
Copy Markdown

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!

@retenta-bot retenta-bot Bot changed the title feat(dashboard): persist GoalTracker goals in MongoDB across devices feat(dashboard): persist GoalTracker goals in MongoDB for cross-device synchronization Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

Asset PR Size Base Size Difference Status
static/chunks/app/(root)/dashboard/[username]/page-[hash].js 54.18 KB 54.03 KB +0.15 KB (+0.28%) 🔴 Regression
static/chunks/app/api/user/goals/route-[hash].js 0.26 KB - +0.26 KB (++100%) 🆕 New

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 4053.84 KB 4052.50 KB +1.34 KB (+0.03%)
Total CSS 338.94 KB 338.94 KB 0 B

@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. mentor:Aamod007 type:feature New features, additions, or enhancements labels Jul 27, 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.

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

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.

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