Skip to content

Commit 3ac6717

Browse files
committed
resolve apollo-client errors
1 parent 4fcb8f3 commit 3ac6717

File tree

10 files changed

+120
-45
lines changed

10 files changed

+120
-45
lines changed

apps/client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"@date-io/date-fns": "^1.3.13",
6666
"@mui/material": "^7.3.1",
6767
"@mui/icons-material": "^7.3.1",
68-
"@mui/lab": "^7.0.0-beta.16",
68+
"@mui/x-date-pickers": "^8.10.2",
6969
"@react-hook/throttle": "^2.2.0",
7070
"@reduxjs/toolkit": "^2.8.2",
7171
"@types/randomcolor": "^0.5.9",
@@ -100,6 +100,7 @@
100100
"redux": "^5.0.1",
101101
"redux-persist": "^6.0.0",
102102
"rollup": "^2.31.0",
103+
"rxjs": "^7.3.0",
103104
"sass": "^1.49.9",
104105
"styled-components": "^4.0.0",
105106
"terser-webpack-plugin": "^3.0.3",
@@ -135,7 +136,6 @@
135136
"@types/sinon": "^7.5.1",
136137
"@typescript-eslint/eslint-plugin": "^5.54.0",
137138
"@typescript-eslint/parser": "^5.54.0",
138-
"@welldone-software/why-did-you-render": "^6.0.5",
139139
"autoprefixer": "6.7.2",
140140
"babel-eslint": "^10.0.3",
141141
"babel-loader": "^8.0.6",

apps/client/src/app.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* istanbul ignore file */
22
import React, { useEffect } from 'react';
33
import { Provider } from 'react-redux';
4-
import { BrowserRouter as Router, Switch, Route, withRouter } from 'react-router-dom';
4+
import { BrowserRouter as Router, Routes, Route, useNavigation } from 'react-router-dom';
55
import { ApolloProvider } from '@apollo/client/react';
66
import * as codemirror from 'codemirror';
77
import { PersistGate } from 'redux-persist/integration/react';
@@ -22,13 +22,6 @@ import { getLocaleMap } from '@generatedata/utils/lang';
2222
import '~store/generator/generator.reducer';
2323
import './styles/global.scss';
2424

25-
// if (process.env.NODE_ENV === 'development') {
26-
// const whyDidYouRender = require('@welldone-software/why-did-you-render');
27-
// whyDidYouRender(React, {
28-
// trackAllPureComponents: true,
29-
// });
30-
// }
31-
3225
window.CodeMirror = codemirror;
3326

3427
const checkState = async (state: any): Promise<any> => {
@@ -59,25 +52,29 @@ const LocalizationWrapper = (args: any) => {
5952
}
6053

6154
return (
62-
<Switch>
55+
<Routes>
6356
{localizedRoutes.map(({ path, component: Component }, index) => (
6457
<Route key={index} path={path}>
6558
<Component />
6659
</Route>
6760
))}
68-
</Switch>
61+
</Routes>
6962
);
7063
};
7164

72-
const App = withRouter(({ history }: any) => {
65+
const App = () => {
66+
const navigation = useNavigation();
67+
7368
useEffect(() => {
74-
initRouteListener(history);
69+
initRouteListener(navigation);
7570
}, []);
7671

7772
return (
7873
<ErrorBoundary>
7974
<Page>
80-
<Route path="/:lang?">{LocalizationWrapper}</Route>
75+
<Route path="/:lang?">
76+
<LocalizationWrapper />
77+
</Route>
8178
<Toast />
8279
<SaveDataSetDialog />
8380
</Page>

apps/client/src/components/TextField.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ type TextFieldProps = {
1313
autoFocus?: boolean;
1414
className?: string;
1515
tooltipPlacement?: string;
16+
name?: string;
17+
style?: React.CSSProperties;
18+
disabled?: boolean;
19+
type?: string;
20+
onPaste?: (e: any) => void;
21+
onKeyDown?: (e: any) => void;
1622
};
1723

1824
const TextField = ({ throttle, error, value, onChange, tooltipPlacement, className, ref, ...props }: TextFieldProps) => {

apps/client/src/components/datePicker/LocalizedDatePicker.component.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import DateFnsUtils from '@date-io/date-fns';
3-
import { DatePicker, MuiPickersUtilsProvider } from '@mui/lab';
3+
// import { DatePicker, MuiPickersUtilsProvider } from '@mui/lab';
4+
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
45
import { getLocale, getStrings } from '@generatedata/utils/lang';
56
import { arDZ, de, enUS, es, fr, ja, hi, nl, pt, ru, ta, zhCN } from 'date-fns/locale';
67

apps/client/src/core/dialogs/tourIntro/TourIntro.component.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ type Tour = 'intro' | 'gridPanel' | 'previewPanel' | 'yourAccount';
1212
export type TourDialogProps = {
1313
tourIntroDialogVisible: boolean;
1414
showTourIntroDialog: () => void;
15-
currentTour: Tour;
1615
onClose: () => void;
1716
tourBundleLoaded: boolean;
1817
loadTourBundle: () => void;

apps/client/src/core/generationPanel/ActivePacketsList.component.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { useHistory } from 'react-router';
2+
import { useNavigate } from 'react-router';
33
import CheckCircle from '@mui/icons-material/CheckCircle';
44
import Chip from '@mui/material/Chip';
55
import styles from './ActivityPacketsList.scss';
@@ -17,11 +17,11 @@ export type ActivePacketList = {
1717

1818
export type ActivePacketsListProps = {
1919
packetList: ActivePacketList[];
20-
openPacket: (packetId: string, history: any) => void;
20+
openPacket: (packetId: string, navigate: any) => void;
2121
};
2222

2323
const ActivePacketsList = ({ packetList, openPacket }: ActivePacketsListProps) => {
24-
const history = useHistory();
24+
const navigate = useNavigate();
2525

2626
const chips = packetList.map(({ packetId, label, percentage, numRowsToGenerate, isPaused }, index) => {
2727
const color = isPaused ? 'default' : 'primary';
@@ -68,7 +68,7 @@ const ActivePacketsList = ({ packetList, openPacket }: ActivePacketsListProps) =
6868
className={styles.chip}
6969
clickable
7070
color={color}
71-
onClick={(): void => openPacket(packetId, history)}
71+
onClick={(): void => openPacket(packetId, navigate)}
7272
variant="outlined"
7373
style={{ marginLeft: 10 }}
7474
/>

apps/client/src/core/queries.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { gql, TypedDocumentNode } from '@apollo/client';
22

3-
type GetAccounts = {
3+
export type GetAccounts = {
44
accounts: {
55
totalCount: number;
66
results: {
@@ -42,7 +42,7 @@ export const GET_ACCOUNTS: TypedDocumentNode<GetAccounts> = gql`
4242
}
4343
`;
4444

45-
type DeleteAccount = {
45+
export type DeleteAccount = {
4646
deleteAccount: {
4747
success: boolean;
4848
error: string;

apps/client/src/core/store/account/account.actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { GDAction } from '~types/general';
99
import { addToast } from '@generatedata/utils/general';
1010
import { getStrings } from '@generatedata/utils/lang';
1111
import * as queries from '~core/queries';
12+
import type { RenameDataSet } from '~core/queries';
1213
import { SET_ONE_TIME_PASSWORD } from '~store/main/main.actions';
1314

1415
export const UPDATE_ACCOUNT = 'UPDATE_ACCOUNT';
@@ -256,7 +257,7 @@ export const renameDataSet =
256257
}
257258
});
258259

259-
if (data.renameDataSet.success) {
260+
if ((data as RenameDataSet).renameDataSet.success) {
260261
dispatch({
261262
type: UPDATE_CURRENT_DATA_SET_NAME,
262263
payload: {

apps/client/src/core/store/packets/packets.actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const logDataBatch =
5151

5252
// if the packet has been fully generated track the generated row count
5353
if (isLoggedIn && currentDataSetId !== null && numRowsToGenerate === numGeneratedRows) {
54-
const resp = await apolloClient.mutate({
54+
const { data } = await apolloClient.mutate({
5555
mutation: gql`
5656
mutation UpdateDataSetGenerationCount($dataSetId: ID!, $generatedRows: Int!) {
5757
updateDataSetGenerationCount(dataSetId: $dataSetId, generatedRows: $generatedRows) {
@@ -66,7 +66,7 @@ export const logDataBatch =
6666
}
6767
});
6868

69-
if (resp.data.updateDataSetGenerationCount.success) {
69+
if (data?.updateDataSetGenerationCount?.success) {
7070
dispatch(updateTotalGenerationCount(numGeneratedRows));
7171
}
7272
}

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)