Frontend base Migration - #616
jesusbalderramawgu wants to merge 24 commits into
Conversation
|
Thanks for the pull request, @jesusbalderramawgu! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
There was a problem hiding this comment.
🔵 Needs a closer look
This is a large migration touching runtime bootstrapping, data-fetching/state architecture, and build/publish tooling, and it includes at least one confirmed build/publish-blocking defect that must be fixed first.
Pull request overview
Migrates frontend-app-gradebook from a standalone MFE (webpack + @edx/frontend-platform + Redux) into a @openedx/frontend-base-compatible library that is intended to run inside the frontend-base shell, aligning with the migration guide referenced in Issue #497.
Changes:
- Replaces the legacy platform/bootstrap approach with a frontend-base
Appexport (src/app.ts), route definitions (src/routes.tsx), and site configs (site.config.*.tsx). - Moves client state/data-fetching away from Redux thunks/reducers/selectors to React Query + context-based UI/filter state, and updates components accordingly.
- Updates tooling to frontend-base equivalents (TypeScript configs, Jest config, Babel, ESLint) and adds Turbo/Nodemon support for the new workflow.
File summaries
| File | Description |
|---|---|
| webpack.prod.config.js | Removes legacy webpack prod config (frontend-base tooling now owns build). |
| webpack.dev.config.js | Removes legacy webpack dev config (frontend-base tooling now owns dev). |
| turbo.site.json | Adds Turbo task config for site build/watch workflows. |
| tsconfig.json | Adds TS config extending frontend-base defaults and sets @src/* path alias. |
| tsconfig.build.json | Adds TS build config for emitting dist/ and excluding tests/mocks. |
| src/utils/hoc.test.jsx | Removes unused React import under the new JSX transform. |
| src/utils/hoc.jsx | Removes unused React import under the new JSX transform. |
| src/style.scss | Introduces app-scoped runtime SCSS entrypoint for the library. |
| src/slots/README.md | Documents slot offerings for host-site customization via frontend-base slots. |
| src/slots/FooterSlot/README.md | Adds detailed documentation for the footer slot and plugin examples. |
| src/setupTest.tsx | Replaces Jest test bootstrap with frontend-base config/logging seeding. |
| src/setupTest.js | Removes legacy env-var seeding test bootstrap. |
| src/segment.js | Switches Segment key lookup from frontend-platform config to frontend-base site config. |
| src/routes.tsx | Adds frontend-base route definitions with authenticated loader + role handle. |
| src/providers.ts | Adds providers registry for frontend-base app integration. |
| src/plugin-slots/README.md | Removes legacy plugin-slots docs in favor of new src/slots/ structure. |
| src/messages.ts | Adds frontend-base message definitions for document title. |
| src/Main.tsx | Adds new main page entry component using frontend-base providers/wrappers. |
| src/index.ts | Exposes library entry exports (app/routes/messages) for host shell consumption. |
| src/index.test.jsx | Removes tests for the legacy platform bootstrap (initialize/subscribe). |
| src/index.jsx | Removes legacy app bootstrap entrypoint (now library exports). |
| src/i18n/utils.test.jsx | Updates i18n utilities tests to mock frontend-base i18n APIs. |
| src/i18n/utils.js | Switches i18n helpers from frontend-platform to frontend-base APIs. |
| src/i18n/messages.d.ts | Adds TS typing for site messages shape from frontend-base. |
| src/i18n/index.ts | Replaces legacy empty messages export with messages entrypoint. |
| src/i18n/index.js | Removes legacy empty array export for messages. |
| src/head/messages.js | Migrates head/title messages to frontend-base defineMessages. |
| src/head/Head.test.jsx | Removes tests for the legacy Head component (component removed). |
| src/head/Head.jsx | Removes legacy Head component (title now handled in Main.tsx / shell). |
| src/data/utils.test.js | Removes Redux-era selector utility tests (Redux removed). |
| src/data/thunkActions/tracks.test.js | Removes Redux thunk tests (thunks removed). |
| src/data/thunkActions/tracks.js | Removes tracks thunk (replaced by React Query hooks). |
| src/data/thunkActions/testUtils.js | Removes Redux thunk test helpers (no longer needed). |
| src/data/thunkActions/roles.js | Removes roles thunk (replaced by getCanUserViewGradebook + query). |
| src/data/thunkActions/index.js | Removes thunkActions index (Redux removed). |
| src/data/thunkActions/cohorts.test.js | Removes cohorts thunk tests (thunks removed). |
| src/data/thunkActions/cohorts.js | Removes cohorts thunk (replaced by React Query hooks). |
| src/data/thunkActions/assignmentTypes.test.js | Removes assignment-types thunk tests (thunks removed). |
| src/data/thunkActions/assignmentTypes.js | Removes assignment-types thunk (replaced by React Query hooks). |
| src/data/thunkActions/app.js | Removes Redux app thunks (replaced by contexts/hooks). |
| src/data/store.js | Removes Redux store creation (Redux removed). |
| src/data/services/segment/utils.test.js | Removes redux-beacon Segment utils tests (redux-beacon removed). |
| src/data/services/segment/utils.js | Removes redux-beacon Segment utils (replaced by direct sendTrackEvent). |
| src/data/services/segment/mapping.js | Removes redux-beacon mapping (replaced by direct tracking functions). |
| src/data/services/segment/events.js | Adds direct Segment tracking helpers using frontend-base sendTrackEvent. |
| src/data/services/segment/constants.js | Removes Redux trigger mapping; keeps event names/constants for direct tracking. |
| src/data/services/lms/utils.js | Migrates LMS client utils to frontend-base authenticated HTTP client + @src paths. |
| src/data/services/lms/urls.js | Migrates LMS URL construction to frontend-base site config. |
| src/data/services/lms/messages.js | Updates imports to @src/utils pathing. |
| src/data/services/lms/index.js | Updates imports to @src/utils pathing. |
| src/data/services/lms/constants.js | Updates imports to @src/utils pathing. |
| src/data/services/lms/api.js | Updates imports to @src/utils pathing. |
| src/data/selectors/tracks.test.js | Removes Redux selectors tests (selectors removed). |
| src/data/selectors/tracks.js | Removes Redux selectors (replaced by hook read-models). |
| src/data/selectors/roles.test.js | Removes Redux selectors tests (selectors removed). |
| src/data/selectors/roles.js | Removes Redux selectors (replaced by queries/hooks). |
| src/data/selectors/cohorts.test.js | Removes Redux selectors tests (selectors removed). |
| src/data/selectors/cohorts.js | Removes Redux selectors (replaced by queries/hooks). |
| src/data/selectors/assignmentTypes.test.js | Removes Redux selectors tests (selectors removed). |
| src/data/selectors/assignmentTypes.js | Removes Redux selectors (replaced by queries/hooks). |
| src/data/redux/transforms.test.js | Removes Redux transform tests (Redux removed). |
| src/data/redux/transforms.js | Removes Redux transforms (replaced by plain utilities). |
| src/data/redux/hooks/utils.test.js | Removes Redux hook utils tests (Redux removed). |
| src/data/redux/hooks/utils.js | Removes Redux hook utils (Redux removed). |
| src/data/redux/hooks/thunkActions.test.js | Removes Redux thunk hook tests (Redux removed). |
| src/data/redux/hooks/thunkActions.js | Removes Redux thunk hooks (Redux removed). |
| src/data/redux/hooks/index.test.js | Removes Redux hooks index tests (Redux removed). |
| src/data/redux/hooks/index.js | Removes Redux hooks index (Redux removed). |
| src/data/redux/hooks/actions.test.js | Removes Redux action hook tests (Redux removed). |
| src/data/redux/hooks/actions.js | Removes Redux action hooks (Redux removed). |
| src/data/reducers/tracks.test.js | Removes Redux reducer tests (Redux removed). |
| src/data/reducers/tracks.js | Removes Redux reducer (Redux removed). |
| src/data/reducers/roles.test.js | Removes Redux reducer tests (Redux removed). |
| src/data/reducers/roles.js | Removes Redux reducer (Redux removed). |
| src/data/reducers/index.js | Removes Redux root reducer (Redux removed). |
| src/data/reducers/filters.js | Removes Redux filters reducer (replaced by context). |
| src/data/reducers/config.test.js | Removes Redux config reducer tests (Redux removed). |
| src/data/reducers/config.js | Removes Redux config reducer (replaced by queries). |
| src/data/reducers/cohorts.test.js | Removes Redux cohorts reducer tests (Redux removed). |
| src/data/reducers/cohorts.js | Removes Redux cohorts reducer (Redux removed). |
| src/data/reducers/assignmentTypes.test.js | Removes Redux assignment-types reducer tests (Redux removed). |
| src/data/reducers/assignmentTypes.js | Removes Redux assignment-types reducer (Redux removed). |
| src/data/queryKeys.ts | Adds top-level React Query key factories for shared app queries. |
| src/data/queryClient.ts | Adds shared React Query client with retry/stale defaults. |
| src/data/formatUtils.js | Extracts pure formatting helpers out of Redux module. |
| src/data/filtersSnapshot.ts | Adds synchronous filter snapshot used by non-React helpers. |
| src/data/constants/grades.js | Updates imports to @src/utils pathing. |
| src/data/constants/filters.messages.js | Migrates defineMessages usage to frontend-base i18n. |
| src/data/constants/filters.js | Updates imports to @src/utils pathing. |
| src/data/constants/app.js | Updates imports to @src/utils pathing. |
| src/data/apiHook.ts | Adds core React Query hooks for roles gate + assignment-types config. |
| src/data/api.ts | Adds API wrappers for permission gate + assignment types derivation. |
| src/data/actions/utils.test.js | Removes Redux action utils tests (Redux removed). |
| src/data/actions/utils.js | Removes Redux action utils (replaced by plain modules). |
| src/data/actions/tracks.test.js | Removes Redux actions tests (Redux removed). |
| src/data/actions/tracks.js | Removes Redux actions (Redux removed). |
| src/data/actions/testUtils.js | Removes Redux action test helpers (Redux removed). |
| src/data/actions/roles.test.js | Removes Redux actions tests (Redux removed). |
| src/data/actions/roles.js | Removes Redux actions (Redux removed). |
| src/data/actions/index.js | Removes Redux actions index (Redux removed). |
| src/data/actions/filters.test.js | Removes Redux actions tests (Redux removed). |
| src/data/actions/filters.js | Removes Redux actions (Redux removed). |
| src/data/actions/config.test.js | Removes Redux actions tests (Redux removed). |
| src/data/actions/config.js | Removes Redux actions (Redux removed). |
| src/data/actions/cohorts.test.js | Removes Redux actions tests (Redux removed). |
| src/data/actions/cohorts.js | Removes Redux actions (Redux removed). |
| src/data/actions/assignmentTypes.test.js | Removes Redux actions tests (Redux removed). |
| src/data/actions/assignmentTypes.js | Removes Redux actions (Redux removed). |
| src/data/actions/app.test.js | Removes Redux app actions tests (Redux removed). |
| src/data/actions/app.js | Removes Redux app actions (Redux removed). |
| src/containers/GradebookPage/GradebookDataLoader.jsx | Adds headless data-loader to eagerly mount the primary grades query. |
| src/constants.ts | Adds frontend-base appId constant. |
| src/components/GradesView/StatusAlerts/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/StatusAlerts/index.jsx | Replaces Redux-based alert state with context + hooks. |
| src/components/GradesView/StatusAlerts/hooks.js | Removes Redux-era hook wrapper for alerts. |
| src/components/GradesView/SpinnerIcon.test.jsx | Updates spinner tests to mock new hook source. |
| src/components/GradesView/SpinnerIcon.jsx | Switches spinner visibility source from Redux selector to hook. |
| src/components/GradesView/SearchControls/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/SearchControls/index.test.jsx | Updates tests to use new test utilities/provider wrappers. |
| src/components/GradesView/SearchControls/index.jsx | Removes unused React import under new JSX transform. |
| src/components/GradesView/SearchControls/hooks.js | Replaces Redux state/actions with filters context + query refetch hook. |
| src/components/GradesView/ScoreViewInput/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/ScoreViewInput/index.jsx | Replaces Redux selectors/actions with UI context and hooks. |
| src/components/GradesView/PageButtons/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/PageButtons/index.jsx | Replaces Redux hook indirection with direct hooks and i18n. |
| src/components/GradesView/PageButtons/hooks.test.js | Removes Redux-era page button hook tests (hook removed). |
| src/components/GradesView/PageButtons/hooks.js | Removes Redux-era page button hook (logic moved inline). |
| src/components/GradesView/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/InterventionsReport/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/InterventionsReport/index.jsx | Replaces Redux/middleware download tracking with direct tracking + hooks. |
| src/components/GradesView/InterventionsReport/hooks.test.js | Removes Redux-era hook tests (hook removed). |
| src/components/GradesView/InterventionsReport/hooks.js | Removes Redux-era hook (logic moved inline). |
| src/components/GradesView/index.jsx | Replaces useGradesViewData facade with direct context/hook wiring. |
| src/components/GradesView/ImportSuccessToast/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/ImportSuccessToast/index.test.jsx | Updates tests to new provider-aware test utils. |
| src/components/GradesView/ImportSuccessToast/index.jsx | Removes unused React import under new JSX transform. |
| src/components/GradesView/ImportSuccessToast/hooks.js | Moves view/toast state updates to UI context. |
| src/components/GradesView/ImportGradesButton/ref.test.jsx | Removes legacy ref-focused tests tied to removed hook. |
| src/components/GradesView/ImportGradesButton/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/ImportGradesButton/index.jsx | Moves import/upload behavior to direct hooks + inline handlers. |
| src/components/GradesView/ImportGradesButton/hooks.test.js | Removes Redux-era hook tests (hook removed). |
| src/components/GradesView/ImportGradesButton/hooks.js | Removes Redux-era hook (logic moved inline). |
| src/components/GradesView/hooks.test.js | Removes Redux-era grades view hook tests (hook removed). |
| src/components/GradesView/hooks.js | Removes Redux-era grades view hook (logic moved inline). |
| src/components/GradesView/GradebookTable/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/GradebookTable/LabelReplacements.test.jsx | Updates i18n mocking and rendering helpers for frontend-base. |
| src/components/GradesView/GradebookTable/LabelReplacements.jsx | Switches i18n + StrictDict imports to frontend-base and @src. |
| src/components/GradesView/GradebookTable/index.test.jsx | Updates tests to new provider-aware render helper. |
| src/components/GradesView/GradebookTable/index.jsx | Removes unused React import under new JSX transform. |
| src/components/GradesView/GradebookTable/hooks.jsx | Replaces Redux selectors/transforms with hooks + plain utils. |
| src/components/GradesView/GradebookTable/GradeButton.jsx | Wires grade cell behavior to queries + UI context instead of Redux. |
| src/components/GradesView/GradebookTable/Fields.jsx | Updates StrictDict import to @src/utils. |
| src/components/GradesView/FilterMenuToggle/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/FilterMenuToggle/index.test.jsx | Updates tests to UI context mocking + provider-aware rendering. |
| src/components/GradesView/FilterMenuToggle/index.jsx | Uses UI context for filter menu toggling and frontend-base i18n. |
| src/components/GradesView/FilteredUsersLabel/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/FilteredUsersLabel/index.test.jsx | Updates tests to hook mocking + provider-aware rendering. |
| src/components/GradesView/FilteredUsersLabel/index.jsx | Replaces Redux selector with grades data hook. |
| src/components/GradesView/FilterBadges/test.jsx | Updates filter constants import path to @src. |
| src/components/GradesView/FilterBadges/index.jsx | Updates filter badge ordering import path to @src. |
| src/components/GradesView/FilterBadges/FilterBadge.jsx | Replaces Redux selector with a new hook-based config read. |
| src/components/GradesView/EditModal/OverrideTable/ReasonInput/ref.test.jsx | Removes legacy hook-based ref tests (hook removed). |
| src/components/GradesView/EditModal/OverrideTable/ReasonInput/index.test.jsx | Removes legacy component tests tied to removed hook. |
| src/components/GradesView/EditModal/OverrideTable/ReasonInput/index.jsx | Moves reason input state to UI context (no Redux). |
| src/components/GradesView/EditModal/OverrideTable/ReasonInput/hooks.test.jsx | Removes Redux-era hook tests (hook removed). |
| src/components/GradesView/EditModal/OverrideTable/ReasonInput/hooks.js | Removes Redux-era hook (logic moved inline). |
| src/components/GradesView/EditModal/OverrideTable/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/EditModal/OverrideTable/index.jsx | Replaces Redux hook facade with direct query/hooks + inline column config. |
| src/components/GradesView/EditModal/OverrideTable/hooks.test.js | Removes Redux-era hook tests (hook removed). |
| src/components/GradesView/EditModal/OverrideTable/hooks.js | Removes Redux-era hook (logic moved inline). |
| src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/index.jsx | Moves adjusted-grade input state to UI context + hooks. |
| src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/hooks.test.jsx | Removes Redux-era hook tests (hook removed). |
| src/components/GradesView/EditModal/OverrideTable/AdjustedGradeInput/hooks.js | Removes Redux-era hook (logic moved inline). |
| src/components/GradesView/EditModal/ModalHeaders.jsx | Replaces Redux selectors with UI context + grade override hook. |
| src/components/GradesView/EditModal/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/EditModal/index.jsx | Replaces Redux modal/actions with UI context + mutation hook. |
| src/components/GradesView/EditModal/hooks.test.js | Removes Redux-era hook tests (hook removed). |
| src/components/GradesView/EditModal/hooks.js | Removes Redux-era hook (logic moved inline). |
| src/components/GradesView/EditModal/HistoryHeader.test.jsx | Updates tests to provider-aware rendering helper. |
| src/components/GradesView/EditModal/HistoryHeader.jsx | Removes unused React import under new JSX transform. |
| src/components/GradesView/data/queryKeys.ts | Adds React Query keys for grades + override-history queries. |
| src/components/GradesView/BulkManagementControls/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradesView/BulkManagementControls/index.jsx | Replaces Redux dispatch/middleware with direct tracking + URL navigation. |
| src/components/GradesView/BulkManagementControls/hooks.test.js | Removes Redux-era hook tests (hook removed). |
| src/components/GradesView/BulkManagementControls/hooks.js | Removes Redux-era hook (logic moved inline). |
| src/components/GradebookHeader/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradebookHeader/index.jsx | Updates i18n import + LMS URL import pathing. |
| src/components/GradebookHeader/hooks.js | Replaces Redux selectors/actions with UI context + query hooks. |
| src/components/GradebookFilters/StudentGroupsFilter/index.jsx | Migrates i18n import to frontend-base. |
| src/components/GradebookFilters/StudentGroupsFilter/hooks.js | Replaces Redux selectors/actions with filters context + React Query data. |
| src/components/GradebookFilters/SelectGroup.test.jsx | Removes unused React import under new JSX transform. |
| src/components/GradebookFilters/SelectGroup.jsx | Removes unused React import under new JSX transform. |
| src/components/GradebookFilters/PercentGroup.test.jsx | Updates tests to provider-aware render helper. |
| src/components/GradebookFilters/PercentGroup.jsx | Removes unused React import under new JSX transform. |
| src/components/GradebookFilters/messages.js | Migrates messages to frontend-base i18n. |
| src/components/GradebookFilters/index.test.jsx | Updates tests to provider-aware render helper. |
| src/components/GradebookFilters/index.jsx | Replaces Redux facade hook with UI/filter contexts + refetch hook. |
| src/components/GradebookFilters/hooks.test.jsx | Removes Redux-era hook tests (hook removed). |
| src/components/GradebookFilters/hooks.js | Removes Redux-era hook (logic moved inline). |
| src/components/GradebookFilters/data/queryKeys.ts | Adds React Query keys for cohorts/tracks filter data. |
| src/components/GradebookFilters/data/hooks.js | Adds hook read-models for selected cohort/track and grade validity. |
| src/components/GradebookFilters/data/apiHook.ts | Adds React Query hooks for cohorts/tracks. |
| src/components/GradebookFilters/data/api.ts | Adds API wrappers for cohorts/tracks. |
| src/components/GradebookFilters/CourseGradeFilter/index.test.jsx | Updates tests to provider-aware rendering helper. |
| src/components/GradebookFilters/CourseGradeFilter/index.jsx | Migrates i18n import to frontend-base. |
| src/components/GradebookFilters/CourseGradeFilter/hooks.js | Replaces Redux with filters context + tracking + refetch. |
| src/components/GradebookFilters/AssignmentTypeFilter/index.jsx | Replaces Redux with queries + filters context. |
| src/components/GradebookFilters/AssignmentTypeFilter/hooks.js | Removes Redux-era hook (logic moved inline). |
| src/components/GradebookFilters/AssignmentGradeFilter/index.test.jsx | Updates tests to provider-aware rendering helper. |
| src/components/GradebookFilters/AssignmentGradeFilter/index.jsx | Migrates i18n import to frontend-base. |
| src/components/GradebookFilters/AssignmentGradeFilter/hooks.js | Replaces Redux with filters context + refetch + selected-assignment hook. |
| src/components/GradebookFilters/AssignmentFilter/index.jsx | Replaces Redux with filters context + hooks + conditional refetch. |
| src/components/GradebookFilters/AssignmentFilter/hooks.test.js | Removes Redux-era hook tests (hook removed). |
| src/components/GradebookFilters/AssignmentFilter/hooks.js | Removes Redux-era hook (logic moved inline). |
| src/components/EdxHeader/index.jsx | Switches config reads to frontend-base site config keys. |
| src/components/EdxHeader/EdxHeader.test.jsx | Removes legacy tests tied to frontend-platform getConfig. |
| src/components/BulkManagementHistoryView/ResultsSummary.test.jsx | Updates imports + provider-aware rendering helper. |
| src/components/BulkManagementHistoryView/ResultsSummary.jsx | Updates LMS import pathing to @src. |
| src/components/BulkManagementHistoryView/messages.js | Migrates messages to frontend-base i18n. |
| src/components/BulkManagementHistoryView/index.test.jsx | Updates tests to provider-aware rendering helper. |
| src/components/BulkManagementHistoryView/index.jsx | Migrates FormattedMessage import to frontend-base. |
| src/components/BulkManagementHistoryView/HistoryTable.jsx | Replaces Redux connect container with React Query-based container. |
| src/components/BulkManagementHistoryView/data/utils.ts | Adds shaping utilities for bulk history API payload to table model. |
| src/components/BulkManagementHistoryView/data/queryKeys.ts | Adds React Query keys for bulk history. |
| src/components/BulkManagementHistoryView/data/apiHook.ts | Adds React Query hooks + gates for bulk history entries. |
| src/components/BulkManagementHistoryView/data/api.ts | Adds API wrapper for bulk operation history. |
| src/components/BulkManagementHistoryView/BulkManagementAlerts.jsx | Replaces Redux selectors with UI context-driven alert state. |
| src/app.ts | Adds frontend-base App object wiring appId/routes/providers. |
| src/App.test.jsx | Removes tests for the legacy standalone App component. |
| src/App.scss | Removes legacy app-wide SCSS entry (replaced by src/style.scss). |
| src/App.jsx | Removes legacy standalone App component (now library). |
| src/mocks/svg.js | Adds Jest mock for SVG imports. |
| src/mocks/file.js | Adds Jest mock for PNG imports. |
| site.config.test.tsx | Adds frontend-base test site config for Jest/runtime seeding. |
| site.config.dev.tsx | Adds frontend-base dev site config using the shell + header/footer apps. |
| nodemon.json | Adds nodemon config for watching src changes. |
| jest.config.js | Switches Jest config generator to frontend-base tooling and updates mappings/ignores. |
| eslint.config.js | Adds new ESLint flat config via frontend-base tooling. |
| babel.config.js | Switches Babel config generator to frontend-base tooling. |
| app.d.ts | Adds TS declarations for frontend-base types + asset module declarations. |
| .npmignore | Updates npm publish ignore rules (currently contains a typo). |
| .gitignore | Updates ignore rules for dist/turbo/temp/editor artifacts relevant to new workflow. |
| .eslintrc.js | Removes legacy ESLint config in favor of eslint.config.js. |
| .eslintignore | Removes legacy ignore file (handled by flat config). |
| .env.development | Removes legacy env file (frontend-base uses site config / shell). |
| .env | Removes legacy production env file (frontend-base uses site config / shell). |
Review details
- Files reviewed: 295/319 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "extends @edx/browserslist-config" | ||
| ], | ||
| "dependencies": { | ||
| "@edx/brand": "npm:@openedx/brand-openedx@^1.2.3", |
There was a problem hiding this comment.
shouldnt be a dependency anymore on frontendbase
| "@edx/openedx-atlas": "^0.6.0", | ||
| "@fortawesome/fontawesome-svg-core": "^1.2.25", | ||
| "@fortawesome/free-brands-svg-icons": "^5.11.2", | ||
| "@fortawesome/free-solid-svg-icons": "^5.11.2", |
There was a problem hiding this comment.
can we change the icons that use this dependency here to paragon icons?
| @@ -0,0 +1,19 @@ | |||
| const BASE_KEY = ['gradebook'] as const; | |||
There was a problem hiding this comment.
you have multiple files defining this constant why dont you define it in a constants file and import it when needed?
There was a problem hiding this comment.
thank you for your feedback, I have addressed all your comments
aaf323a to
09bccab
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #616 +/- ##
==========================================
+ Coverage 95.06% 95.46% +0.40%
==========================================
Files 139 112 -27
Lines 1357 1192 -165
Branches 266 210 -56
==========================================
- Hits 1290 1138 -152
+ Misses 59 50 -9
+ Partials 8 4 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| jest.mock('./api', () => ({ getBulkOperationHistory: jest.fn() })); | ||
| jest.mock('./utils', () => ({ transformHistoryEntry: jest.fn((e) => ({ shaped: e.id })) })); | ||
|
|
||
| const useAssignmentTypesMock = useAssignmentTypes as unknown as jest.Mock; |
There was a problem hiding this comment.
why adding as unknown?
| @@ -1,11 +1,9 @@ | |||
| /* eslint-disable react/sort-comp, react/button-has-type */ | |||
| import React from 'react'; | |||
| import PropTypes from 'prop-types'; | |||
There was a problem hiding this comment.
should we get rid of proptypes or is a diff effort?
There was a problem hiding this comment.
I'm definitely gonna do it, but I was thinking of doing that at the end once everything is approved so I can get rid of this and rename the files from .js to .ts But I want to avoid adding new files right now given that the PR is huge
|
I will get rid of the proptypes and will rename some pending .js files to .ts files once we get progress in this review to avoid adding more files to this huge PR. |
PR to migrate this repository to frontend base. It closes this #497
Turning the MFE into a library that runs inside the
frontend-base shell. Follows the official "Migrating an MFE to frontend-base" guide.
How I have tested this change?
Ran unit tests
Built the project
Ran it locally
Note:
I also made a migration from redux to react query, I made some house keeping and minor refactors moving the code from redux to react query, but the main target of this PR is migrating to frontend base, so I suggest to do a refactor once this is merge.
I made a summary with the steps I followed with claude for a better explanation with the things I did on this PR:
Migration Summary:
frontend-app-gradebookOverall Context
Full migration from Redux → React Query + Context API, parallel with adoption of the frontend-base stack (SiteConfig / SiteContext / paragon). Goal: align gradebook with the pattern already used in
frontend-app-admin-console.1. Starting State (Legacy Redux)
store.js,actions/,reducers/,thunkActions/,redux/,selectors/).fetchGrades,fetchRoles,fetchAssignmentTypes,fetchGradeOverrideHistory,fetchBulkOperationHistory,updateGradebook,uploadGradeCsv, etc.selectors.grades.useBulkManagementHistoryEntries,selectors.root.localFilters).redux-beaconmiddleware.@edx/frontend-platform(no longer supported).2. Data Layer: Redux → React Query
API layer split in two
api.ts— pureasyncfunctions (getGrades,getGradeOverrideHistory,getBulkOperationHistory,getCanUserViewGradebook,getAssignmentTypes,getCohorts,getTracks).apiHook.ts—useQuery/useMutationhooks with a single-responsibility signature:(courseId, { enabled }) => UseQueryResult. The caller decides when the fetch runs.React Query facades
useGrades+useGradesData(shaped read-model: results sorted by username,prevPage,nextPage, counts).useGradeOverrideHistory— modal,retry: false, gated onsubsectionId + userId.useUpdateGrades— mutation withinvalidateQueries+ Segment tracking + page reset.useSubmitImportGradesButtonData— CSV upload with cross-featureinvalidateQueries.useBulkOperationHistory+useBulkManagementHistoryEntries.useCanUserViewGradebook+useCanViewGradebook(optimistic while loading,falseon error).useCourseIdWithGate— pattern to defer queries until the route + role are ready.useAssignmentTypes+useShowBulkManagement.Centralized query keys
src/data/queryKeys.ts—BASE_KEY = ['gradebook']exported (reviewer feedback: it was duplicated in 4 files).BASE_KEYfrom its ownqueryKeys.ts.Client
queryClient.ts.3. UI State: Redux → Context API
Two app-scope providers replace the UI-state portion of the store:
FiltersProvider(src/data/filtersContext.tsx)assignment,assignmentType,cohort,track, grade limits,searchValue,includeCourseRoleMembers).resetFilters(names[])+applyFilters.filtersSnapshot(mutable ref) for imperative reads outside React (fetchers).GradebookUiProvider(src/data/gradebookUiContext.tsx)modalState,setModalState,setModalStateFromTable).toggleFilterMenu,closeFilterMenu,handleFilterMenuTransitionEnd,filterMenuTransitioning).resetCsvUpload,markCsvUploadSuccess,setCsvUploadErrors).gradesPageEndpoint,activeView,gradeFormat,showSuccess,showImportSuccessToast).Both providers expose
useFilters()/useGradebookUi()that throw when used outside the provider (guardrail).4. Removing Legacy Modules
Marked
// DELETE THIS FILE LATERand later removed:src/data/actions/(all)src/data/reducers/(all)src/data/thunkActions/(all)src/data/redux/(all)src/data/selectors/(all, including theindex.jsStrictDict facade)src/data/store.js,store.test.jssrc/data/utils.js,utils.test.js(relevant helpers were re-exported from new utils)src/data/services/segment/redux-beaconmiddlewaresrc/App.jsx,App.test.jsx,src/index.jsx,src/index.test.jsx(replaced by frontend-base bootstrap)src/testUtils.js+src/testUtilsExtra.jsx(replaced bysrc/testUtils.tsx)src/components/EdxHeader/(now provided by frontend-base'sheaderApp)5. Small Targeted Refactors
Component / hook simplifications
React.memo.useState(expensiveCall())→useState(() => expensiveCall()).useMemowith unstable dependencies (intl) → pre-compute stable values.useCallbackfor handlers passed to children.Safe refs
useRef()with no arg → explicituseRef(null).ref.current.method()→ref.current?.method()(optional chaining).ReasonInput,ImportGradesButton.React import cleanup
React.useEffect/React.useRefreference without an actualReactimport → named imports (useEffect,useRef). React 17+ JSX transform makes them unnecessary anyway.Icon migration
SpinnerIconnow uses paragon's<Spinner>).Data fetching cleanup
GradebookDataLoaderheadless component: mounts the main grades query inside the routed subtree.Shared constant
BASE_KEYextracted tosrc/data/queryKeys.tsand reused across all 4 features (it was a literal duplicate).Selectors → utils / hooks
Composite Redux selectors were split into:
buildGradesFetchParams,subsectionGrade,headingMapper,chooseRelevantAssignmentData,isDefault) inGradesView/data/utils.tsand analogous feature files.useGradesHeadings,useSelectableAssignmentLabels,useSelectedAssignmentLabel,useShouldShowSpinner,useAllGrades,useUserCounts,useGradeData,useFilterBadgeConfig,useGradeOverrideData,useEditModalPossibleGrade,useRefetchGrades,useFetchGradesIfAssignmentGradeFiltersSet,useFetchPrevNextGrades) inGradesView/data/hooks.js.Facade-style
selectors.grades.useXcalls are gone; consumers import the hook directly.