Skip to content

fix(web): synchronize milestone achievements with database to prevent duplicates#93

Open
Novice47 wants to merge 2 commits into
AnirbansarkarS:mainfrom
Novice47:fix-milestone-dedup
Open

fix(web): synchronize milestone achievements with database to prevent duplicates#93
Novice47 wants to merge 2 commits into
AnirbansarkarS:mainfrom
Novice47:fix-milestone-dedup

Conversation

@Novice47

Copy link
Copy Markdown

Description

This PR addresses the issue where milestone achievements are spammed across multiple devices for a single user.

Cause

Currently, Stats.jsx relies on localStorage to check if a milestone has already been logged. When a user logs in from a new device (or clears browser data), the localStorage key is missing, causing isMilestoneAchieved to return false. This triggers duplicate requests to the backend to log the milestone, which spams the feed.

Solution

  • Added getUserMilestones(userId) helper in activityService.js to fetch all already logged milestones from the database.
    • Implemented syncMilestonesToLocalStorage(milestones) helper in Stats.jsx to synchronize the achievements fetched from the database to the local device's localStorage during initial load.
    • Integrated the database fetch and sync check within loadData() before checkMilestones() runs. This ensures localStorage is seeded with existing achievements, preventing duplicates on new devices.
      Acknowledge: Developed with assistance from Antigravity.

@vercel

vercel Bot commented May 24, 2026

Copy link
Copy Markdown

@Novice47 is attempting to deploy a commit to the anirbansarkars' projects Team on Vercel.

A member of the Team first needs to authorize it.

@Karanjot786

Copy link
Copy Markdown

Hey @Novice47! Saw your work on GSSoC 2026.

We are building TermUI, a TypeScript terminal UI framework with React-style hooks and JSX, rendered entirely in the terminal.

We have 67 unassigned GSSoC issues open. 19 are marked good first issue. Your JavaScript background transfers directly.

Karanjot, TermUI maintainer

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants