Skip to content

Leaderboard hardcodes currentUserId = user-1 instead of reading from session - #301

Merged
Benjtalkshow merged 2 commits into
boundlessfi:mainfrom
nanaabdul1172:Leaderboard
Jun 27, 2026
Merged

Leaderboard hardcodes currentUserId = user-1 instead of reading from session#301
Benjtalkshow merged 2 commits into
boundlessfi:mainfrom
nanaabdul1172:Leaderboard

Conversation

@nanaabdul1172

@nanaabdul1172 nanaabdul1172 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

closes #271

implemented changes:

Added import { authClient } from "@/lib/auth-client" to the imports.
Replaced the hardcoded const currentUserId = "user-1" (and its stale comment) with:
const { data: session } = authClient.useSession();
const currentUserId = session?.user?.id;
currentUserId is now string | undefined — undefined when signed out, which both LeaderboardTable and UserRankSidebar already handle gracefully.

Summary by CodeRabbit

  • Bug Fixes
    • The leaderboard now uses the signed-in user’s account for personalized ranking behavior instead of a fixed demo user.
    • User-specific highlights and sidebar behavior on the leaderboard should now reflect the correct session.

@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

@nanaabdul1172 is attempting to deploy a commit to the Threadflow Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@nanaabdul1172 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e44cad4f-dada-418a-94f5-57cd14bf0492

📥 Commits

Reviewing files that changed from the base of the PR and between 9e5dc91 and 13029e8.

📒 Files selected for processing (2)
  • .vscode/settings.json
  • app/leaderboard/page.tsx

📝 Walkthrough

Walkthrough

The leaderboard now derives the current user id from the authenticated session and passes it to user-specific widgets. The VS Code settings file is rewritten as an empty JSON object.

Changes

Leaderboard session identity

Layer / File(s) Summary
Session-derived current user id
app/leaderboard/page.tsx
The page imports authClient, reads authClient.useSession(), and uses session?.user?.id for UserRankSidebar and LeaderboardTable.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • Issue 272: Replaces a hardcoded demo user id with a session-derived id for leaderboard-specific UI behavior.

Possibly related PRs

  • boundlessfi/bounties#190: Also updates app/leaderboard/page.tsx to derive currentUserId from authClient.useSession() for the leaderboard widgets.

Suggested reviewers

  • Benjtalkshow

Poem

I hopped through the code with a curious thump,
Found the right session and gave it a bump.
No more demo id in the leaderboard light,
Just a real user name feeling quite right. 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The .vscode/settings.json edit is unrelated to the leaderboard fix and appears out of scope. Remove the .vscode/settings.json change unless it is required for the leaderboard session-id fix.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the leaderboard session-id fix and matches the main change.
Linked Issues check ✅ Passed The session-derived currentUserId change and prop wiring satisfy issue #271's requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Benjtalkshow Benjtalkshow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean fix for #271, CI is green and tsc + lint pass locally. One small
thing: please revert .vscode/settings.json out of this PR — the only
change there is {} becoming {\n}, which is editor-induced churn and
doesn't belong in the diff. Also attach a screenshot of the leaderboard
while signed in (showing your own row highlighted) so I can verify the
visual result. Once those are done, ready to merge.

@Benjtalkshow Benjtalkshow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@Benjtalkshow
Benjtalkshow merged commit d4b9256 into boundlessfi:main Jun 27, 2026
4 of 5 checks passed
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.

Leaderboard hardcodes currentUserId = "user-1" instead of reading from session

2 participants