Skip to content

Commit d889b18

Browse files
committed
Upgrade to React 18
1 parent 2306d2c commit d889b18

File tree

133 files changed

+26000
-216
lines changed

Some content is hidden

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

133 files changed

+26000
-216
lines changed

site/package-lock.json

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

site/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
"front-matter": "4.0.2",
4444
"history": "5.3.0",
4545
"just-debounce-it": "3.0.1",
46-
"react": "17.0.2",
47-
"react-dom": "17.0.2",
48-
"react-helmet": "6.1.0",
46+
"react": "^18.2.0",
47+
"react-dom": "^18.2.0",
48+
"react-helmet": "^6.1.0",
4949
"react-markdown": "8.0.3",
5050
"react-router-dom": "6.3.0",
5151
"sourcemapped-stacktrace": "1.1.11",
@@ -72,8 +72,8 @@
7272
"@types/express": "4.17.13",
7373
"@types/jest": "27.4.1",
7474
"@types/node": "14.18.22",
75-
"@types/react": "17.0.44",
76-
"@types/react-dom": "17.0.16",
75+
"@types/react": "^18.0.15",
76+
"@types/react-dom": "^17.0.17",
7777
"@types/react-helmet": "6.1.5",
7878
"@types/superagent": "4.1.15",
7979
"@types/uuid": "8.3.4",

site/src/AppRouter.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ const WorkspacesPage = lazy(() => import("./pages/WorkspacesPage/WorkspacesPage"
3131
const CreateWorkspacePage = lazy(() => import("./pages/CreateWorkspacePage/CreateWorkspacePage"))
3232
const AuditPage = lazy(() => import("./pages/AuditPage/AuditPage"))
3333

34-
export const AppRouter: FC = () => {
34+
export const AppRouter: FC<React.PropsWithChildren<unknown>> = () => {
3535
const xServices = useContext(XServiceContext)
3636
const permissions = useSelector(xServices.authXService, selectPermissions)
37-
3837
return (
3938
<Suspense fallback={<></>}>
4039
<Routes>

site/src/Main.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { inspect } from "@xstate/inspect"
2-
import ReactDOM from "react-dom"
2+
import { createRoot } from "react-dom/client"
33
import { Interpreter } from "xstate"
44
import { App } from "./app"
55

@@ -25,7 +25,11 @@ const main = () => {
2525
██████▀▄█ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀ ▀▀▀▀ ▀
2626
`)
2727
const element = document.getElementById("root")
28-
ReactDOM.render(<App />, element)
28+
if (element === null) {
29+
throw new Error("root element is null")
30+
}
31+
const root = createRoot(element)
32+
root.render(<App />)
2933
}
3034

3135
main()

site/src/__mocks__/react-markdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { FC } from "react"
22

3-
const ReactMarkdown: FC = ({ children }) => {
3+
const ReactMarkdown: FC<React.PropsWithChildren<unknown>> = ({ children }) => {
44
return <div data-testid="markdown">{children}</div>
55
}
66

site/src/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { dark } from "./theme"
99
import "./theme/globalFonts"
1010
import { XServiceProvider } from "./xServices/StateContext"
1111

12-
export const App: FC = () => {
12+
export const App: FC<React.PropsWithChildren<unknown>> = () => {
1313
return (
1414
<Router>
1515
<ThemeProvider theme={dark}>

site/src/components/AppLink/AppLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface AppLinkProps {
1717
appIcon?: TypesGen.WorkspaceApp["icon"]
1818
}
1919

20-
export const AppLink: FC<AppLinkProps> = ({ userName, workspaceName, appName, appIcon }) => {
20+
export const AppLink: FC<React.PropsWithChildren<AppLinkProps>> = ({ userName, workspaceName, appName, appIcon }) => {
2121
const styles = useStyles()
2222
const href = `/@${userName}/${workspaceName}/apps/${appName}`
2323

site/src/components/AuthAndFrame/AuthAndFrame.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface AuthAndFrameProps {
1313
/**
1414
* Wraps page in RequireAuth and renders it between Navbar and Footer
1515
*/
16-
export const AuthAndFrame: FC<AuthAndFrameProps> = ({ children }) => {
16+
export const AuthAndFrame: FC<React.PropsWithChildren<AuthAndFrameProps>> = ({ children }) => {
1717
const styles = useStyles()
1818
const xServices = useContext(XServiceContext)
1919

site/src/components/AvatarData/AvatarData.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface AvatarDataProps {
1818
avatar?: React.ReactNode
1919
}
2020

21-
export const AvatarData: FC<AvatarDataProps> = ({
21+
export const AvatarData: FC<React.PropsWithChildren<AvatarDataProps>> = ({
2222
title,
2323
subtitle,
2424
link,

site/src/components/BorderedMenu/BorderedMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type BorderedMenuProps = Omit<PopoverProps, "variant"> & {
88
variant?: BorderedMenuVariant
99
}
1010

11-
export const BorderedMenu: FC<BorderedMenuProps> = ({ children, variant, ...rest }) => {
11+
export const BorderedMenu: FC<React.PropsWithChildren<BorderedMenuProps>> = ({ children, variant, ...rest }) => {
1212
const styles = useStyles()
1313

1414
return (

0 commit comments

Comments
 (0)