Skip to content

Commit

Permalink
I349 react upgrade (#358)
Browse files Browse the repository at this point in the history
* Upgrading to react typscript, react-query and other package to the next to latest
  • Loading branch information
pushyamig authored Nov 19, 2024
1 parent d87ad19 commit 4543361
Show file tree
Hide file tree
Showing 5 changed files with 2,568 additions and 1,806 deletions.
6 changes: 3 additions & 3 deletions frontend/app/components/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { useQuery } from 'react-query';
import { useQuery } from '@tanstack/react-query';
import { Alert, Box, Grid, LinearProgress, Snackbar, Typography } from '@mui/material';
import { styled } from '@mui/material/styles';

Expand Down Expand Up @@ -36,7 +36,7 @@ function Home (props: HomeProps) {
const [searchFilter, setSearchFilter] = useState('');
const [showRefreshAlert, setShowRefreshAlert] = useState<undefined | boolean>(undefined);

const { isLoading: getToolsLoading, error: getToolsError } = useQuery('getTools', getTools, {
const { isLoading: getToolsLoading, error: getToolsError } = useQuery(['getTools'], getTools, {
onSuccess: (data) => setTools(data)
});

Expand Down Expand Up @@ -105,7 +105,7 @@ function Home (props: HomeProps) {
</div>
</MainContainer>
<Typography component='footer' sx={{ textAlign: 'center' }}>
Copyright © 2022 The Regents of the University of Michigan
Copyright © 2024 The Regents of the University of Michigan
</Typography>
<Snackbar open={showRefreshAlert} onClose={handleRefreshAlertClose} autoHideDuration={10000}>
<Alert severity='info' elevation={2} onClose={handleRefreshAlertClose}>
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/ToolCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import AddBox from '@mui/icons-material/AddBox';
import { useMutation } from 'react-query';
import { useMutation } from '@tanstack/react-query';
import CheckCircleOutline from '@mui/icons-material/CheckCircleOutline';
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
Expand Down
23 changes: 12 additions & 11 deletions frontend/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { QueryClient, QueryClientProvider } from 'react-query';
import { createRoot } from 'react-dom/client';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ThemeProvider } from '@mui/material';

import Home from './components/Home';
Expand All @@ -24,13 +24,14 @@ const queryClient = new QueryClient({
}
});

ReactDOM.render(
(
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<Home globals={globals} />
</ThemeProvider>
</QueryClientProvider>
),
document.getElementById('react-app')
const container = document.getElementById('react-app');
if (container === null) throw Error('"react-app" was not found!');
const root = createRoot(container);

root.render(
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<Home globals={globals} />
</ThemeProvider>
</QueryClientProvider>
);
Loading

0 comments on commit 4543361

Please sign in to comment.