From f51478f917b31666dc17ef9ddf368eac82723051 Mon Sep 17 00:00:00 2001 From: David Thyresson Date: Fri, 1 Sep 2023 07:27:22 -0400 Subject: [PATCH 01/15] Upgrade to RW "6.1.0" --- api/package.json | 4 +- package.json | 2 +- web/package.json | 7 +- web/src/entry.client.tsx | 17 + .../pages/FatalErrorPage/FatalErrorPage.tsx | 12 +- web/vite.config.ts | 19 + yarn.lock | 11034 +++++----------- 7 files changed, 3562 insertions(+), 7533 deletions(-) create mode 100644 web/src/entry.client.tsx create mode 100644 web/vite.config.ts diff --git a/api/package.json b/api/package.json index 0968bd5..dd034e1 100644 --- a/api/package.json +++ b/api/package.json @@ -4,7 +4,7 @@ "private": true, "dependencies": { "@netlify/functions": "1.6.0", - "@redwoodjs/api": "5.2.3", - "@redwoodjs/graphql-server": "5.2.3" + "@redwoodjs/api": "6.1.0", + "@redwoodjs/graphql-server": "6.1.0" } } diff --git a/package.json b/package.json index 427715d..5328c58 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ ] }, "devDependencies": { - "@redwoodjs/core": "5.2.3", + "@redwoodjs/core": "6.1.0", "prettier-plugin-tailwindcss": "^0.3.0" }, "eslintConfig": { diff --git a/web/package.json b/web/package.json index 6e992d7..4117ccc 100644 --- a/web/package.json +++ b/web/package.json @@ -14,9 +14,9 @@ }, "dependencies": { "@heroicons/react": "1.0.6", - "@redwoodjs/forms": "5.2.3", - "@redwoodjs/router": "5.2.3", - "@redwoodjs/web": "5.2.3", + "@redwoodjs/forms": "6.1.0", + "@redwoodjs/router": "6.1.0", + "@redwoodjs/web": "6.1.0", "@tailwindcss/forms": "0.5.3", "@tremor/react": "2.9.1", "date-fns": "^2.30.0", @@ -26,6 +26,7 @@ "react-dom": "18.2.0" }, "devDependencies": { + "@redwoodjs/vite": "6.1.0", "autoprefixer": "10.4.14", "postcss": "8.4.23", "postcss-loader": "7.3.1", diff --git a/web/src/entry.client.tsx b/web/src/entry.client.tsx new file mode 100644 index 0000000..ffee44f --- /dev/null +++ b/web/src/entry.client.tsx @@ -0,0 +1,17 @@ +import { hydrateRoot, createRoot } from 'react-dom/client' + +import App from './App' +/** + * When `#redwood-app` isn't empty then it's very likely that you're using + * prerendering. So React attaches event listeners to the existing markup + * rather than replacing it. + * https://reactjs.org/docs/react-dom-client.html#hydrateroot + */ +const redwoodAppElement = document.getElementById('redwood-app') + +if (redwoodAppElement.children?.length > 0) { + hydrateRoot(redwoodAppElement, ) +} else { + const root = createRoot(redwoodAppElement) + root.render() +} diff --git a/web/src/pages/FatalErrorPage/FatalErrorPage.tsx b/web/src/pages/FatalErrorPage/FatalErrorPage.tsx index d5c959a..b2bb436 100644 --- a/web/src/pages/FatalErrorPage/FatalErrorPage.tsx +++ b/web/src/pages/FatalErrorPage/FatalErrorPage.tsx @@ -5,16 +5,12 @@ // You can modify this page as you wish, but it is important to keep things simple to // avoid the possibility that it will cause its own error. If it does, Redwood will // still render a generic error page, but your users will prefer something a bit more -// thoughtful. =) +// thoughtful :) -// Ensures that production builds do not include the error page -let RedwoodDevFatalErrorPage = undefined -if (process.env.NODE_ENV === 'development') { - RedwoodDevFatalErrorPage = - require('@redwoodjs/web/dist/components/DevFatalErrorPage').DevFatalErrorPage -} +// This import will be automatically removed when building for production +import { DevFatalErrorPage } from '@redwoodjs/web/dist/components/DevFatalErrorPage' -export default RedwoodDevFatalErrorPage || +export default DevFatalErrorPage || (() => (