Skip to content

Fix/unfollow button #519#532

Merged
indresh404 merged 3 commits into
indresh404:mainfrom
riyanshigupta890-cloud:fix/unfollow-button-519
Jun 15, 2026
Merged

Fix/unfollow button #519#532
indresh404 merged 3 commits into
indresh404:mainfrom
riyanshigupta890-cloud:fix/unfollow-button-519

Conversation

@riyanshigupta890-cloud

Copy link
Copy Markdown
Contributor

Pull Request Template 🚀

Description

Fixes the unfollow button not working on the Friends page. The previous implementation used a single atomic writeBatch containing both the follow/unfollow document write and a distributed shard counter update for global stats. If the shard counter write failed (e.g. due to Firestore security rules restricting writes to the aggregates collection), the entire batch failed atomically — silently blocking the actual follow/unfollow action too, with the error only logged to the console.

This PR splits the two operations: the core follow/unfollow document write (delete on unfollow, set on follow) now happens independently and must succeed for the button to work. The shard counter update is now best-effort and non-blocking — its failure no longer prevents follow/unfollow from working.

Related Issue

Closes #519

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots / Videos (if applicable)

Testing Done

  • Command run: npm run test
  • Command run: npm run lint
  • Command run: npm run build
  • Visual verification on local dev server (http://localhost:5173)

Steps to reproduce/verify:

  1. Go to Friends page, click "Follow" on a suggested developer.
  2. Confirm they now appear under the "Following" tab.
  3. Click the follow button again (now showing "Following") to unfollow.
  4. Confirm the developer is removed from "Following" and the button reverts to "Follow".
  5. Checked browser console for errors during both actions.

Checklist

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings or console errors.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

Contributor Declaration

  • I confirm that this contribution is made under the rules of GSSoC 2026 and NSoC 2026.
  • I confirm that I have been assigned the related issue by a maintainer before opening this PR.
  • I have read the Contributing Guidelines and Code of Conduct.

@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ranker-hub Ready Ready Preview, Comment Jun 14, 2026 6:23pm

@github-actions github-actions Bot added backend Backend/Firebase related changes bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels Jun 14, 2026
@indresh404 indresh404 merged commit 269409c into indresh404:main Jun 15, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend/Firebase related changes bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 level3 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: unfollow button isnt working

2 participants