Skip to content

fix: don't leak literal "undefined" into the header when user_id is missing - #267

Open
RudraDudhat2509 wants to merge 1 commit into
OpenLake:mainfrom
RudraDudhat2509:fix/undefined-in-user-details
Open

fix: don't leak literal "undefined" into the header when user_id is missing#267
RudraDudhat2509 wants to merge 1 commit into
OpenLake:mainfrom
RudraDudhat2509:fix/undefined-in-user-details

Conversation

@RudraDudhat2509

Copy link
Copy Markdown
Collaborator

Fixes #263

What changed

Components/common/userIcon.jsx built the account summary line (shown in the header on every page, e.g. "2027 | B.Tech | B21CS001") by directly interpolating batch_year | program | user_id into a template string. Any account with academic_info set but no user_id yet — like the seeded demo student accounts — showed the literal text undefined in the header.

Now builds the line from only whichever of those three fields actually exist.

Testing

Added userIcon.test.jsx (React Testing Library, co-located with the component per this repo's usual pattern — see App.test.js). Two cases: the missing-user_id case that used to break, and a full-data case to make sure the normal path didn't change.

Verified the test is meaningful — temporarily restored the old buggy version and re-ran:

BEFORE (old code): 1 failed, 1 passed, 2 total
AFTER  (this fix):  2 passed, 2 total

Run with CI=true npx react-scripts test src/Components/common/userIcon.test.jsx --watchAll=false in frontend/, or npm test for the full suite.

UserIcon built the academic-info summary line by directly
interpolating batch_year | program | user_id into a template
string. Seeded/onboarded accounts that don't yet have a user_id
set showed literally 'undefined' in the header on every page.

Now builds the line from only the parts that are actually present.

Fixes OpenLake#263
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

@RudraDudhat2509 is attempting to deploy a commit to the openlake's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@RudraDudhat2509, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5c9b7bd6-3bb3-415e-8c88-4db6d3234010

📥 Commits

Reviewing files that changed from the base of the PR and between 3a38811 and bac41ed.

📒 Files selected for processing (2)
  • frontend/src/Components/common/userIcon.jsx
  • frontend/src/Components/common/userIcon.test.jsx

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.

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.

"undefined" leaks into the UI on the Achievements page when a student's academic info is incomplete

1 participant