fix: don't leak literal "undefined" into the header when user_id is missing - #267
fix: don't leak literal "undefined" into the header when user_id is missing#267RudraDudhat2509 wants to merge 1 commit into
Conversation
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
|
@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. |
|
Warning Review limit reached
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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. Comment |
Fixes #263
What changed
Components/common/userIcon.jsxbuilt the account summary line (shown in the header on every page, e.g. "2027 | B.Tech | B21CS001") by directly interpolatingbatch_year | program | user_idinto a template string. Any account withacademic_infoset but nouser_idyet — like the seeded demo student accounts — showed the literal textundefinedin 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 — seeApp.test.js). Two cases: the missing-user_idcase 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:
Run with
CI=true npx react-scripts test src/Components/common/userIcon.test.jsx --watchAll=falseinfrontend/, ornpm testfor the full suite.