Skip to content

Commit

Permalink
fix: Route with PUBLIC_PATH
Browse files Browse the repository at this point in the history
Prior to this change, the MFE would fail to render with any PUBLIC_PATH
set.  Because that is now handled entirely by `frontend-platform`, we
can avoid referring to PUBLIC_PATH entirely, here.
  • Loading branch information
arbrandes committed Dec 8, 2023
1 parent a4eff69 commit cb65877
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { AppProvider } from '@edx/frontend-platform/react';
import Footer from '@edx/frontend-component-footer';
import Header from '@edx/frontend-component-header';

import { routePath } from 'data/constants/app';
import store from 'data/store';
import GradebookPage from 'containers/GradebookPage';
import './App.scss';
Expand All @@ -20,7 +19,7 @@ const App = () => (
<main>
<Routes>
<Route
path={routePath}
path="/:courseId"
element={<GradebookPage />}
/>
</Routes>
Expand Down
6 changes: 1 addition & 5 deletions src/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { AppProvider } from '@edx/frontend-platform/react';
import Footer from '@edx/frontend-component-footer';
import Header from '@edx/frontend-component-header';

import { routePath } from 'data/constants/app';
import store from 'data/store';
import GradebookPage from 'containers/GradebookPage';

Expand All @@ -21,9 +20,6 @@ jest.mock('react-router-dom', () => ({
jest.mock('@edx/frontend-platform/react', () => ({
AppProvider: () => 'AppProvider',
}));
jest.mock('data/constants/app', () => ({
routePath: '/:courseId',
}));
jest.mock('@edx/frontend-component-footer', () => 'Footer');
jest.mock('data/store', () => 'testStore');
jest.mock('containers/GradebookPage', () => 'GradebookPage');
Expand Down Expand Up @@ -66,7 +62,7 @@ describe('App router component', () => {
expect(secondChild.find('main')).toEqual(shallow(
<main>
<Routes>
<Route path={routePath} element={<GradebookPage />} />
<Route path="/:courseId" element={<GradebookPage />} />
</Routes>
</main>,
));
Expand Down
3 changes: 0 additions & 3 deletions src/data/constants/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { StrictDict } from 'utils';
import { getConfig } from '@edx/frontend-platform';

export const routePath = `${getConfig().PUBLIC_PATH}:courseId`;

export const views = StrictDict({
grades: 'grades',
Expand Down

0 comments on commit cb65877

Please sign in to comment.