Skip to content

feat: refactor program dashboard to use react query#827

Open
asharma12-sonata wants to merge 66 commits intoopenedx:masterfrom
edx:abhishek/refactor-program-dashboard
Open

feat: refactor program dashboard to use react query#827
asharma12-sonata wants to merge 66 commits intoopenedx:masterfrom
edx:abhishek/refactor-program-dashboard

Conversation

@asharma12-sonata
Copy link
Copy Markdown

@asharma12-sonata asharma12-sonata commented Apr 10, 2026

This PR includes changes from

#751

This PR adds the programs dashboard in accordance with the above proposal. This is a conversion of the legacy programs dashboard that lives in edx-platform. This PR converts the legacy frontend into a React based frontend that lives under its own route. The route is conditionally rendered based on a new ENABLE_PROGRAM_DASHBOARD environment variable, not to be confused with the ENABLE_PROGRAMS variable, which only handles the rendering of the "Programs" tab. This is done so that operators can choose to either use the legacy frontend or the new React-based frontend.

In order to create a new route in this MFE, the App.jsx file had to be refactored. The LearnerDashboardHeader and FooterSlot were moved out of App.jsx and into index.jsx. This aligns with the way other MFEs are setup. The h1 tag for the app was also moved to the LearnerDashboardHeader so that it would appear on all routes. The Header logic has also been refactored so that the correct tab is highlighted based on the pathname of the page.

All other changes are related to the Program Dashboard itself. The dashboard uses the /api/dashboard/v0/programs/ endpoint to retrieve enrollment data.

Directory structure

src/
└── containers/
    └── ProgramDashboard/
        ├── data/
        │   └── types.d.ts
        └── ProgramsList/
            ├── ExploreProgramsCTA.test.tsx
            ├── ExploreProgramsCTA.tsx
            ├── index.scss
            ├── index.test.tsx
            ├── index.tsx
            ├── messages.ts
            ├── ProgramListCard.test.tsx
            ├── ProgramListCard.tsx
            ├── ProgressCategoryBubbles.test.tsx
            └── ProgressCategoryBubbles.tsx

Other changes are related to using react query for program dashboard.

Programs Dashboard

image image image

deborahgu and others added 30 commits October 15, 2025 18:56
our github actions should point to our release branch
)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Maxwell Frank <92897870+MaxFrank13@users.noreply.github.com>
)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…#783)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…edx#784)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@asharma12-sonata asharma12-sonata force-pushed the abhishek/refactor-program-dashboard branch from f11b964 to 2164115 Compare April 13, 2026 09:54
@asharma12-sonata asharma12-sonata marked this pull request as ready for review April 14, 2026 09:47
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 98.21429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.19%. Comparing base (8f0c78e) to head (65251b0).

Files with missing lines Patch % Lines
...containers/ProgramDashboard/ProgramsList/index.tsx 93.75% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #827      +/-   ##
==========================================
- Coverage   98.19%   98.19%   -0.01%     
==========================================
  Files         145      150       +5     
  Lines        1388     1493     +105     
  Branches      298      322      +24     
==========================================
+ Hits         1363     1466     +103     
- Misses         25       27       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/containers/ProgramDashboard/ProgramsList/index.test.tsx Outdated
Comment thread src/containers/ProgramDashboard/ProgramsList/index.test.tsx Outdated
Comment thread src/containers/ProgramDashboard/data/api.ts Outdated
Comment thread src/containers/ProgramDashboard/ProgramsList/index.test.tsx Outdated
Comment thread src/containers/ProgramDashboard/ProgramsList/index.test.tsx Outdated
Copy link
Copy Markdown
Member

@MaxFrank13 MaxFrank13 left a comment

Choose a reason for hiding this comment

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

Looks good. I had a few questions and suggestions. Also, can we add more screenshots and description similar to the original PR?

Comment thread src/containers/ProgramDashboard/ProgramsList/index.test.tsx Outdated
Comment thread src/containers/ProgramDashboard/ProgramsList/index.test.tsx Outdated
Comment thread src/containers/ProgramDashboard/data/api.test.ts Outdated
Copy link
Copy Markdown
Member

@MaxFrank13 MaxFrank13 left a comment

Choose a reason for hiding this comment

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

Had some additional comments. Also, please include screenshots of Programs being rendered to the dashboard. Also, we should enhance the description to match what we had in the old PR

Comment thread src/data/hooks/queryHooks.test.tsx
@MaxFrank13
Copy link
Copy Markdown
Member

@arbrandes This is ready for your eyes whenever you get time! It's a big one, but most of it is derived from the previous PR: #751

@arbrandes arbrandes self-requested a review April 24, 2026 17:45
@arbrandes
Copy link
Copy Markdown
Contributor

Alright, will do, thanks!

Looks like there's some commit titles that might need fixing up in the meantime.

Copy link
Copy Markdown
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

Looks great! I do have some minor suggestions inline, though.

Comment thread src/index.jsx Outdated
<LearnerDashboardHeader />
<Routes>
<Route path="/" element={<PageWrap><App /></PageWrap>} />
{getConfig().ENABLE_PROGRAM_DASHBOARD && (
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.

Can you please add the new variable to src/config/index.js? It's also common practice to add it to the .env files, in the way of documentation.

And while we're at it, mind adding some documentation about this new feature to the README?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Variable added.

Comment thread src/containers/LearnerDashboardHeader/index.jsx
isLoading,
isError: errorState,
error,
} = useProgramsListData() as {
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.

If you cast the return value of the hook, you're second-guessing Typescript. If we want a strong type for the data (which we do!) the typing should happen in the hook itself.

Parameterize useQuery in src/data/hooks/queryHooks.ts:37-42 with useQuery<ProgramData[]>({...}) (and give fetchProgramsListData a return type in api.ts). Then the consumer can destructure without an as cast and the runtime guards still make sense

Copy link
Copy Markdown
Author

@asharma12-sonata asharma12-sonata Apr 29, 2026

Choose a reason for hiding this comment

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

@arbrandes Implementing this change as suggested would move us away from the current pattern. I couldn’t find any similar implementations in the referenced files—please let me know if I missed something.

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.

There was no pattern in Learner Dashboard. It didn't use Typescript. We're setting the pattern with this, which makes it doubly important that we do it right. Please try doing it as I suggested.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@asharma12-sonata I'm happy to assist with this 👍

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@arbrandes i have made these required changes, please have a look and let me know if there is anything else needed.
CC: @MaxFrank13

import { logError } from '@edx/frontend-platform/logging';

import appMessages from 'messages';
import { useProgramsListData } from '../../../data/hooks/queryHooks';
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.

Probably best to follow the useInitializeLearnerHome pattern: expose useProgramsListData from the index barrel, and import instead from ../../../data/hooks.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

8 participants