Skip to content

Commit

Permalink
[core] Upgrade Toolpad to React 19 (#4488)
Browse files Browse the repository at this point in the history
Co-authored-by: Pedro Ferreira <[email protected]>
Co-authored-by: MUI bot <[email protected]>
  • Loading branch information
3 people authored Jan 10, 2025
1 parent 33560f6 commit 2475607
Show file tree
Hide file tree
Showing 43 changed files with 867 additions and 723 deletions.
15 changes: 7 additions & 8 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@mui/utils": "6.3.1",
"@mui/x-date-pickers": "7.22.2",
"@mui/x-date-pickers-pro": "7.22.2",
"@mui/x-license": "7.21.0",
"@mui/x-license": "7.23.5",
"@toolpad/core": "workspace:*",
"@toolpad/studio": "workspace:*",
"@trendmicro/react-interpolate": "0.5.5",
Expand Down Expand Up @@ -72,13 +72,12 @@
"postcss": "8.4.49",
"prismjs": "1.29.0",
"prop-types": "15.8.1",
"react": "18.3.1",
"react": "^19.0.0",
"react-docgen": "7.0.3",
"react-dom": "18.3.1",
"react-dom": "^19.0.0",
"react-hook-form": "7.53.2",
"react-is": "18.3.1",
"react-is": "^19.0.0",
"react-router": "7.1.0",
"react-router-dom": "6.26.2",
"react-runner": "1.0.5",
"react-simple-code-editor": "0.14.1",
"react-simple-typewriter": "5.0.1",
Expand All @@ -99,9 +98,9 @@
"@types/babel__core": "^7.20.5",
"@types/doctrine": "0.0.9",
"@types/json-schema": "7.0.15",
"@types/react": "18.3.18",
"@types/react-dom": "18.3.5",
"@types/react-is": "18.3.1",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@types/react-is": "^19.0.0",
"@types/react-swipeable-views": "^0.13.6",
"cpy-cli": "5.0.0",
"cross-fetch": "4.0.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/core/auth-nextjs-email/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"next": "^15",
"next-auth": "5.0.0-beta.25",
"nodemailer": "^6",
"react": "^18",
"react-dom": "^18"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20.17.12",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"eslint": "^8",
"prisma": "^5",
"eslint-config-next": "^15"
Expand Down
8 changes: 4 additions & 4 deletions examples/core/auth-nextjs-pages-nextauth-4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"@toolpad/core": "latest",
"next": "^15",
"next-auth": "^4.24.10",
"react": "^18",
"react-dom": "^18"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20.17.12",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"eslint": "^8",
"eslint-config-next": "^15"
}
Expand Down
4 changes: 2 additions & 2 deletions examples/core/auth-nextjs-pages-nextauth-4/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { SessionProvider, signIn, signOut, useSession } from 'next-auth/react';
import LinearProgress from '@mui/material/LinearProgress';

export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
getLayout?: (page: React.ReactElement) => React.ReactNode;
getLayout?: (page: React.ReactElement<any>) => React.ReactNode;
requireAuth?: boolean;
};

Expand Down Expand Up @@ -46,7 +46,7 @@ const AUTHENTICATION = {
signOut,
};

function getDefaultLayout(page: React.ReactElement) {
function getDefaultLayout(page: React.ReactElement<any>) {
return <DashboardLayout>{page}</DashboardLayout>;
}

Expand Down
10 changes: 5 additions & 5 deletions examples/core/auth-nextjs-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"@toolpad/core": "latest",
"next": "^15",
"next-auth": "5.0.0-beta.25",
"react": "^18",
"react-dom": "^18"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20.17.12",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/node": "^20.17.6",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"eslint": "^8",
"eslint-config-next": "^15"
}
Expand Down
4 changes: 2 additions & 2 deletions examples/core/auth-nextjs-pages/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { SessionProvider, signIn, signOut, useSession } from 'next-auth/react';
import LinearProgress from '@mui/material/LinearProgress';

export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
getLayout?: (page: React.ReactElement) => React.ReactNode;
getLayout?: (page: React.ReactElement<any>) => React.ReactNode;
requireAuth?: boolean;
};

Expand Down Expand Up @@ -46,7 +46,7 @@ const AUTHENTICATION = {
signOut,
};

function getDefaultLayout(page: React.ReactElement) {
function getDefaultLayout(page: React.ReactElement<any>) {
return (
<DashboardLayout>
<PageContainer>{page}</PageContainer>
Expand Down
8 changes: 4 additions & 4 deletions examples/core/auth-nextjs-passkey/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"@toolpad/core": "latest",
"next": "^15",
"next-auth": "5.0.0-beta.25",
"react": "^18",
"react-dom": "^18"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "^22",
"@types/react": "^18",
"@types/react": "^19.0.0",
"prisma": "^5",
"@types/react-dom": "^18",
"@types/react-dom": "^19.0.0",
"eslint-config-next": "^15"
}
}
8 changes: 4 additions & 4 deletions examples/core/auth-nextjs-themed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"@toolpad/core": "latest",
"next": "^15",
"next-auth": "^5.0.0-beta.25",
"react": "^19",
"react-dom": "^19"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "^20.17.12",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"eslint": "^8",
"eslint-config-next": "^15",
"typescript": "^5"
Expand Down
8 changes: 4 additions & 4 deletions examples/core/auth-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"@toolpad/core": "latest",
"next": "^15",
"next-auth": "5.0.0-beta.25",
"react": "^18",
"react-dom": "^18"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20.17.12",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"eslint": "^8",
"eslint-config-next": "^15"
}
Expand Down
8 changes: 4 additions & 4 deletions examples/core/auth-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"@mui/icons-material": "^6",
"@mui/material": "^6",
"@toolpad/core": "latest",
"react": "^18",
"react-dom": "^18",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router": "^7"
},
"devDependencies": {
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.3.2",
"typescript": "^5",
"vite": "^5.4.8"
Expand Down
8 changes: 4 additions & 4 deletions examples/core/firebase-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"@mui/icons-material": "^6",
"@mui/material": "^6",
"@toolpad/core": "latest",
"react": "^18",
"react-dom": "^18",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router": "^7"
},
"devDependencies": {
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.3.2",
"typescript": "^5",
"vite": "^5.4.8"
Expand Down
8 changes: 4 additions & 4 deletions examples/core/tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"lint": "next lint"
},
"dependencies": {
"react": "^18",
"react-dom": "^18",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"next": "^15",
"@toolpad/core": "latest",
"@mui/material": "^6",
Expand All @@ -21,8 +21,8 @@
"devDependencies": {
"typescript": "^5",
"@types/node": "^20.17.12",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"eslint": "^8",
"eslint-config-next": "^15"
}
Expand Down
8 changes: 4 additions & 4 deletions examples/core/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"@mui/icons-material": "^6",
"@mui/material": "^6",
"@toolpad/core": "latest",
"react": "^18",
"react-dom": "^18",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router": "^7"
},
"devDependencies": {
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.3.2",
"typescript": "^5",
"vite": "^5.4.8"
Expand Down
6 changes: 3 additions & 3 deletions examples/studio/custom-server-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"@toolpad/studio": "0.5.2",
"express": "4.20.0",
"next": "14.2.10",
"react": "18.3.1",
"react-dom": "18.3.1"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/react": "18.3.3"
"@types/react": "^19.0.0"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
"@mui/internal-markdown": "1.0.24",
"@mui/internal-scripts": "1.0.32",
"@mui/monorepo": "github:mui/material-ui#0221d17856a63d89e832d49f652b1e189ab7b7cf",
"@mui/x-charts": "7.22.2",
"@mui/x-charts": "7.23.2",
"@next/eslint-plugin-next": "14.2.22",
"@playwright/test": "1.47.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "16.0.1",
"@testing-library/react": "16.1.0",
"@testing-library/user-event": "14.5.2",
"@types/archiver": "6.0.3",
"@types/fs-extra": "11.0.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-toolpad-app/src/templates/packageJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const packageJson: PackageJsonTemplate = (options) => {
}

const dependencies: Record<string, string> = {
react: '^18',
'react-dom': '^18',
react: '^19',
'react-dom': '^19',
'@toolpad/core': coreVersion ?? 'latest',
'@mui/material': '^6',
'@mui/material-nextjs': '^6',
Expand Down
6 changes: 3 additions & 3 deletions packages/toolpad-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"@mui/material": "6.3.1",
"@types/invariant": "2.2.37",
"@types/prop-types": "15.7.14",
"@types/react": "18.3.18",
"@types/react-dom": "18.3.5",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@types/sinon": "^17.0.3",
"@vitest/browser": "2.1.8",
"next": "^15.1.3",
Expand All @@ -84,7 +84,7 @@
"@mui/icons-material": "5 - 6",
"@mui/material": "5 - 6",
"next": "^14 || ^15",
"react": "^18",
"react": "^18 || ^19",
"react-router": "^7"
},
"peerDependenciesMeta": {
Expand Down
14 changes: 7 additions & 7 deletions packages/toolpad-studio-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
"@mui/icons-material": "6.3.1",
"@mui/lab": "6.0.0-beta.22",
"@mui/material": "6.3.1",
"@mui/x-charts": "7.22.2",
"@mui/x-data-grid-premium": "7.22.2",
"@mui/x-date-pickers": "7.22.2",
"@mui/x-license": "7.21.0",
"@mui/x-charts": "7.23.2",
"@mui/x-data-grid-premium": "7.23.5",
"@mui/x-date-pickers": "7.23.3",
"@mui/x-license": "7.23.5",
"@tanstack/react-query": "5.61.3",
"@toolpad/studio-runtime": "workspace:*",
"@toolpad/utils": "workspace:*",
Expand All @@ -59,11 +59,11 @@
},
"devDependencies": {
"@types/invariant": "2.2.37",
"@types/react": "18.3.18",
"react": "18.3.1"
"@types/react": "^19.0.0",
"react": "^19.0.0"
},
"peerDependencies": {
"react": "^18.0.0"
"react": "^18.0.0 || ^19.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 4 additions & 4 deletions packages/toolpad-studio-components/src/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1010,16 +1010,16 @@ function useDataProviderDataGridProps(
}));
apiRef.current.scrollToIndexes({ rowIndex: 0, colIndex });
},
},
} satisfies EditToolbarProps as GridToolbarProps,
},
};
}

type NoRowsOverlayProps = React.ComponentProps<typeof GridNoRowsOverlay>;

interface NoRowsOverlayPropsX extends NoRowsOverlayProps {
type NoRowsOverlayPropsX = NoRowsOverlayProps & {
error?: Error | null;
}
};

function NoRowsOverlay(props: NoRowsOverlayPropsX) {
if (props.error) {
Expand Down Expand Up @@ -1331,7 +1331,7 @@ const DataGridComponent = React.forwardRef(function DataGridComponent(
slotProps={{
noRowsOverlay: {
error: rowLoadingError,
} as any,
} satisfies NoRowsOverlayPropsX as NoRowsOverlayProps,
...dataProviderSlotProps,
}}
onColumnResize={handleResize}
Expand Down
Loading

0 comments on commit 2475607

Please sign in to comment.