Akshay fix Skills Overview data mismatch on HGN Questionnaire Dashboard - #5440
Draft
akv-iu wants to merge 2 commits into
Draft
Akshay fix Skills Overview data mismatch on HGN Questionnaire Dashboard#5440akv-iu wants to merge 2 commits into
akv-iu wants to merge 2 commits into
Conversation
✅ Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The radar chart on /hgnhelp/skills-overview read state.userProfile, which holds the HGN account profile and never contains skillInfo. The survey data lives in the userSkills slice and was only ever fetched by the /hgn/profile/skills page, so the overview always fell back to the 'Complete the skills survey' empty state. Fetch the profile from ENDPOINTS.SKILLS_PROFILE on mount instead, so the page works on direct navigation and refresh. Users without survey data (isPlaceholder) keep the existing inline message and are not redirected.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Original Task
Description
The Skills Overview page (
/hgnhelp/skills-overview) never displays the logged-in user's HGN skills survey responses. The "Your Skills Radar" section always falls back to the empty-state message "Complete the skills survey to view your radar chart", even for users who have fully completed the survey. The same user's data renders correctly on/hgn/profile/skills, which makes the dashboard look inconsistent and untrustworthy.Root cause is in
src/components/HGNHelpSkillsDashboard/SkillsOverviewPage.jsx. The component reads the survey data from the wrong Redux slice, and nothing on this route ever requests it:state.userProfile, which is the HGN account profile slice (userProfileByIdReducer). Survey data lives in a different slice,state.userSkills(userSkillsReducer). The keyskillInfois never written touserProfileanywhere in the codebase, so the guarduserProfile?.skillInfois always falsy and the page always renders the empty state.ENDPOINTS.SKILLS_PROFILE(/skills/profile/:userId), is called from exactly one place in the app —UserSkillsProfile.jsx, which is the/hgn/profile/skillspage. That is precisely why the data only ever appears there.Because of point 2, simply pointing the selector at the correct slice is not a real fix: Redux state is in-memory, so it would only work if the user happened to visit
/hgn/profile/skillsfirst in the same session, and would break on refresh or direct navigation. This PR therefore has the Skills Overview page fetch its own data on mount, the same way the working page does.Related PRS (if any):
No backend PR is required for this fix. The backend is unaffected —
/skills/profile/:userIdalready returns correct data and is consumed unchanged.For context only, the Skills Overview route being fixed here was introduced by frontend PR #3360 in this repository.
Main changes explained:
src/components/HGNHelpSkillsDashboard/SkillsOverviewPage.jsxto fetch the logged-in user's skills profile on mount viaENDPOINTS.SKILLS_PROFILE, and render the radar chart from that response instead of from a Redux slice that never holds it.How to test:
Akshay_fix_skills_overview_data_mismatchnpm installto install dependencies, then run the app locally (npm run start:localfor frontend, backend on port 4500)/hgn/profile/skillsand note the radar chart values/hgnhelp/skills-overviewand verify the "Your Skills Radar" section now renders the radar chart, and that the values match what you saw in step 5/hgnhelp/skills-overviewdirectly (without visiting/hgn/profile/skillsfirst) and verify the chart still renders — this is the case that was previously broken/hgnhelp/skills-overview, and verify the "Complete the skills survey to view your radar chart" message still shows, and that you are not redirected away from the pageScreenshots or videos of changes:
Note:
Scope is deliberately limited to a single file. No shared reducer, action, route, endpoint or styling is touched, and
/hgn/profile/skillsis not modified, so no other page changes behaviour.One intentional difference from
/hgn/profile/skills: that page redirects the user to/hgnformwith a toast when no survey data exists. This PR does not copy that redirect. On Skills Overview a user without survey data simply sees the existing inline empty-state message, since redirecting away from the overview page would be a behaviour change beyond the scope of this bug.