Skip to content

Commit 0d709d1

Browse files
feat: React Query migration (#1629)
Move from Redux to React Query across the board.
1 parent 642853e commit 0d709d1

151 files changed

Lines changed: 7942 additions & 5034 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@openedx/frontend-plugin-framework": "^1.7.0",
4040
"@openedx/paragon": "^23.4.2",
4141
"@optimizely/react-sdk": "^2.9.1",
42-
"@redux-devtools/extension": "3.3.0",
42+
"@tanstack/react-query": "^5.90.19",
4343
"@testing-library/react": "^16.2.0",
4444
"algoliasearch": "^4.14.3",
4545
"algoliasearch-helper": "^3.26.0",
@@ -53,23 +53,18 @@
5353
"react-dom": "^18.3.1",
5454
"react-helmet": "6.1.0",
5555
"react-loading-skeleton": "3.5.0",
56-
"react-redux": "7.2.9",
5756
"react-responsive": "8.2.0",
5857
"react-router": "6.30.3",
5958
"react-router-dom": "6.30.3",
6059
"react-zendesk": "^0.1.13",
61-
"redux": "4.2.1",
62-
"redux-logger": "3.0.6",
63-
"redux-mock-store": "1.5.5",
64-
"redux-saga": "1.4.2",
65-
"redux-thunk": "2.4.2",
6660
"regenerator-runtime": "0.14.1",
67-
"reselect": "5.1.1",
6861
"universal-cookie": "7.2.2"
6962
},
7063
"devDependencies": {
7164
"@edx/browserslist-config": "^1.1.1",
65+
"@edx/typescript-config": "^1.1.0",
7266
"@openedx/frontend-build": "^14.6.2",
67+
"@testing-library/jest-dom": "^6.9.1",
7368
"babel-plugin-formatjs": "10.5.41",
7469
"eslint-plugin-import": "2.32.0",
7570
"glob": "7.2.3",

src/MainApp.jsx

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import React from 'react';
2-
31
import { getConfig } from '@edx/frontend-platform';
42
import { AppProvider } from '@edx/frontend-platform/react';
3+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
54
import { Helmet } from 'react-helmet';
65
import { Navigate, Route, Routes } from 'react-router-dom';
76

87
import {
98
EmbeddedRegistrationRoute, NotFoundPage, registerIcons, UnAuthOnlyRoute, Zendesk,
109
} from './common-components';
11-
import configureStore from './data/configureStore';
1210
import {
1311
AUTHN_PROGRESSIVE_PROFILING,
1412
LOGIN_PAGE,
@@ -31,33 +29,48 @@ import './index.scss';
3129

3230
registerIcons();
3331

32+
const queryClient = new QueryClient({
33+
defaultOptions: {
34+
mutations: {
35+
retry: false,
36+
},
37+
},
38+
});
39+
3440
const MainApp = () => (
35-
<AppProvider store={configureStore()}>
36-
<Helmet>
37-
<link rel="shortcut icon" href={getConfig().FAVICON_URL} type="image/x-icon" />
38-
</Helmet>
39-
{getConfig().ZENDESK_KEY && <Zendesk />}
40-
<Routes>
41-
<Route path="/" element={<Navigate replace to={updatePathWithQueryParams(REGISTER_PAGE)} />} />
42-
<Route
43-
path={REGISTER_EMBEDDED_PAGE}
44-
element={<EmbeddedRegistrationRoute><RegistrationPage /></EmbeddedRegistrationRoute>}
45-
/>
46-
<Route
47-
path={LOGIN_PAGE}
48-
element={
49-
<UnAuthOnlyRoute><Logistration selectedPage={LOGIN_PAGE} /></UnAuthOnlyRoute>
50-
}
51-
/>
52-
<Route path={REGISTER_PAGE} element={<UnAuthOnlyRoute><Logistration /></UnAuthOnlyRoute>} />
53-
<Route path={RESET_PAGE} element={<UnAuthOnlyRoute><ForgotPasswordPage /></UnAuthOnlyRoute>} />
54-
<Route path={PASSWORD_RESET_CONFIRM} element={<ResetPasswordPage />} />
55-
<Route path={AUTHN_PROGRESSIVE_PROFILING} element={<ProgressiveProfiling />} />
56-
<Route path={RECOMMENDATIONS} element={<RecommendationsPage />} />
57-
<Route path={PAGE_NOT_FOUND} element={<NotFoundPage />} />
58-
<Route path="*" element={<Navigate replace to={PAGE_NOT_FOUND} />} />
59-
</Routes>
60-
</AppProvider>
41+
<QueryClientProvider client={queryClient}>
42+
<AppProvider>
43+
<Helmet>
44+
<link rel="shortcut icon" href={getConfig().FAVICON_URL} type="image/x-icon" />
45+
</Helmet>
46+
{getConfig().ZENDESK_KEY && <Zendesk />}
47+
<Routes>
48+
<Route path="/" element={<Navigate replace to={updatePathWithQueryParams(REGISTER_PAGE)} />} />
49+
<Route
50+
path={REGISTER_EMBEDDED_PAGE}
51+
element={<EmbeddedRegistrationRoute><RegistrationPage /></EmbeddedRegistrationRoute>}
52+
/>
53+
<Route
54+
path={LOGIN_PAGE}
55+
element={
56+
<UnAuthOnlyRoute><Logistration selectedPage={LOGIN_PAGE} /></UnAuthOnlyRoute>
57+
}
58+
/>
59+
<Route
60+
path={REGISTER_PAGE}
61+
element={
62+
<UnAuthOnlyRoute><Logistration selectedPage={REGISTER_PAGE} /></UnAuthOnlyRoute>
63+
}
64+
/>
65+
<Route path={RESET_PAGE} element={<UnAuthOnlyRoute><ForgotPasswordPage /></UnAuthOnlyRoute>} />
66+
<Route path={PASSWORD_RESET_CONFIRM} element={<ResetPasswordPage />} />
67+
<Route path={AUTHN_PROGRESSIVE_PROFILING} element={<ProgressiveProfiling />} />
68+
<Route path={RECOMMENDATIONS} element={<RecommendationsPage />} />
69+
<Route path={PAGE_NOT_FOUND} element={<NotFoundPage />} />
70+
<Route path="*" element={<Navigate replace to={PAGE_NOT_FOUND} />} />
71+
</Routes>
72+
</AppProvider>
73+
</QueryClientProvider>
6174
);
6275

6376
export default MainApp;

src/base-container/components/default-layout/DefaultLayout.test.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
import { IntlProvider } from '@edx/frontend-platform/i18n';
42
import { render, screen } from '@testing-library/react';
53

src/base-container/components/default-layout/LargeLayout.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
import { getConfig } from '@edx/frontend-platform';
42
import { useIntl } from '@edx/frontend-platform/i18n';
53
import { Hyperlink, Image } from '@openedx/paragon';

src/base-container/components/default-layout/MediumLayout.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
import { getConfig } from '@edx/frontend-platform';
42
import { useIntl } from '@edx/frontend-platform/i18n';
53
import { Hyperlink, Image } from '@openedx/paragon';

src/base-container/components/default-layout/SmallLayout.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
import { getConfig } from '@edx/frontend-platform';
42
import { useIntl } from '@edx/frontend-platform/i18n';
53
import { Hyperlink, Image } from '@openedx/paragon';

src/base-container/components/welcome-page-layout/LargeLayout.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
import { getConfig } from '@edx/frontend-platform';
42
import { useIntl } from '@edx/frontend-platform/i18n';
53
import { Hyperlink, Image } from '@openedx/paragon';

src/base-container/components/welcome-page-layout/MediumLayout.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
import { getConfig } from '@edx/frontend-platform';
42
import { useIntl } from '@edx/frontend-platform/i18n';
53
import { Hyperlink, Image } from '@openedx/paragon';

src/base-container/components/welcome-page-layout/SmallLayout.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
import { getConfig } from '@edx/frontend-platform';
42
import { useIntl } from '@edx/frontend-platform/i18n';
53
import { Hyperlink, Image } from '@openedx/paragon';

0 commit comments

Comments
 (0)