From ddfe9d1d0a1b0f63e5607c5a63b477fd8291ce98 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 3 Apr 2022 11:40:55 +0000 Subject: [PATCH 1/3] Upgrade dependencies Use React 18 --- package.json | 10 +++++----- yarn.lock | 53 +++++++++++++++++++++++++--------------------------- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 8e79a8e92..1294eab64 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,10 @@ "@primer/octicons-react": "^17.0.0", "jsonwebtoken": "^8.5.1", "next": "^12.1.4", - "next-translate": "^1.3.5", - "preact": "^10.7.0", - "react": "17.0.2", - "react-dom": "17.0.2", + "next-translate": "^1.4.0", + "preact": "^10.7.1", + "react": "18.0.0", + "react-dom": "18.0.0", "swr": "^1.2.2" }, "devDependencies": { @@ -36,7 +36,7 @@ "@prefresh/next": "^1.5.2", "@types/jsonwebtoken": "^8.5.7", "@types/node": "^14.18.12", - "@types/react": "^17.0.43", + "@types/react": "^18.0.0", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", "autoprefixer": "^10.4.4", diff --git a/yarn.lock b/yarn.lock index 3c2637243..eaf92d4fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -307,10 +307,10 @@ resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.4.tgz#fcf7205c25dff795ee79af1e30da2c9790808f11" integrity sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ== -"@types/react@^17.0.43": - version "17.0.43" - resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.43.tgz#4adc142887dd4a2601ce730bc56c3436fdb07a55" - integrity sha512-8Q+LNpdxf057brvPu1lMtC5Vn7J119xrP1aq4qiaefNioQUYANF/CYeK4NsKorSZyUGJ66g0IM+4bbjwx45o2A== +"@types/react@^18.0.0": + version "18.0.0" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.0.tgz#4be8aa3a2d04afc3ac2cc1ca43d39b0bd412890c" + integrity sha512-7+K7zEQYu7NzOwQGLR91KwWXXDzmTFODRVizJyIALf6RfLv2GDpqpknX64pvRVILXCpXi7O/pua8NGk44dLvJw== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" @@ -2360,10 +2360,10 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -next-translate@^1.3.5: - version "1.3.5" - resolved "https://registry.yarnpkg.com/next-translate/-/next-translate-1.3.5.tgz#06541951737028f1e78addce5ebec3b51a1460ba" - integrity sha512-JXNAuHsEjV/lGSghAQaYbKyxDr3ZQk1BiIKlGTKZg1qrxWjgxrj0sfmraQ6kRQORh7qC+OBQCVeiIkCCJfirxA== +next-translate@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/next-translate/-/next-translate-1.4.0.tgz#8e423ea9010019ac9573cb6c88412273f8210f77" + integrity sha512-FWheoN83fWTTfZ2g+a77GBcXRDVfSDP45iA0+G5wRZYE3xPYMy/6X+1I5j+ouczoJ2JI54vH59W/veZ1tZDRGQ== next@^12.1.4: version "12.1.4" @@ -2946,10 +2946,10 @@ postcss@^8.1.6, postcss@^8.3.5, postcss@^8.4.12: picocolors "^1.0.0" source-map-js "^1.0.2" -preact@^10.7.0: - version "10.7.0" - resolved "https://registry.yarnpkg.com/preact/-/preact-10.7.0.tgz#3bd424677a894c8199f66a881df283b44bea0eeb" - integrity sha512-9MEURwzNMKpAil/t6+wabDIJI6oG6GnwypYxiJDvQnW+fHDTt51PYuLZ1QUM31hFr7sDaj9qTaShAF9VIxuxGQ== +preact@^10.7.1: + version "10.7.1" + resolved "https://registry.yarnpkg.com/preact/-/preact-10.7.1.tgz#bdd2b2dce91a5842c3b9b34dfe050e5401068c9e" + integrity sha512-MufnRFz39aIhs9AMFisonjzTud1PK1bY+jcJLo6m2T9Uh8AqjD77w11eAAawmjUogoGOnipECq7e/1RClIKsxg== prelude-ls@^1.2.1: version "1.2.1" @@ -3036,27 +3036,25 @@ quick-lru@^5.1.1: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== -react-dom@17.0.2: - version "17.0.2" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23" - integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA== +react-dom@18.0.0: + version "18.0.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.0.0.tgz#26b88534f8f1dbb80853e1eabe752f24100d8023" + integrity sha512-XqX7uzmFo0pUceWFCt7Gff6IyIMzFUn7QMZrbrQfGxtaxXZIcGQzoNpRLE3fQLnS4XzLLPMZX2T9TRcSrasicw== dependencies: loose-envify "^1.1.0" - object-assign "^4.1.1" - scheduler "^0.20.2" + scheduler "^0.21.0" react-is@^16.13.1: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== -react@17.0.2: - version "17.0.2" - resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" - integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA== +react@18.0.0: + version "18.0.0" + resolved "https://registry.yarnpkg.com/react/-/react-18.0.0.tgz#b468736d1f4a5891f38585ba8e8fb29f91c3cb96" + integrity sha512-x+VL6wbT4JRVPm7EGxXhZ8w8LTROaxPXOqhlGyVSrv0sB1jkyFGgXxJ8LVoPRLvPR6/CIZGFmfzqUa2NYeMr2A== dependencies: loose-envify "^1.1.0" - object-assign "^4.1.1" read-cache@^1.0.0: version "1.0.0" @@ -3196,13 +3194,12 @@ safe-buffer@^5.0.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -scheduler@^0.20.2: - version "0.20.2" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91" - integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ== +scheduler@^0.21.0: + version "0.21.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.21.0.tgz#6fd2532ff5a6d877b6edb12f00d8ab7e8f308820" + integrity sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ== dependencies: loose-envify "^1.1.0" - object-assign "^4.1.1" "semver@2 || 3 || 4 || 5", semver@^5.6.0: version "5.7.1" From eee5891b71accd23e76363012f6e514f186226fe Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Sat, 9 Apr 2022 10:38:04 +0700 Subject: [PATCH 2/3] Only use Preact for production build --- next.config.js | 4 +++- pages/_app.tsx | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/next.config.js b/next.config.js index 098c5afcc..ed409afc4 100644 --- a/next.config.js +++ b/next.config.js @@ -62,7 +62,9 @@ module.exports = withBundleAnalyzer( }, ]; }, - webpack: (config) => { + webpack: (config, { dev, isServer }) => { + if (dev || isServer) return config; + config.resolve.alias = { ...config.resolve.alias, react: 'preact/compat', diff --git a/pages/_app.tsx b/pages/_app.tsx index 5f94c4204..0576cb160 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,7 +1,3 @@ -if (process.env.NODE_ENV === 'development') { - import('preact/debug'); -} - import Head from 'next/head'; import 'tailwindcss/tailwind.css'; import '../styles/base.css'; From 897c585d5163092c2e79ff1321c21f7dd2fad0b5 Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Sat, 9 Apr 2022 10:45:25 +0700 Subject: [PATCH 3/3] Fix hydration mismatch due to different order of attributes --- lib/adapter.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/adapter.ts b/lib/adapter.ts index 0fca466a7..731d17457 100644 --- a/lib/adapter.ts +++ b/lib/adapter.ts @@ -141,7 +141,10 @@ export function handleCommentClick(event: ReactMouseEvent