diff --git a/examples/with-redux-saga/reducer.js b/examples/with-redux-saga/reducer.js index 99f3fb2fff1f..bf6f733bd230 100644 --- a/examples/with-redux-saga/reducer.js +++ b/examples/with-redux-saga/reducer.js @@ -9,7 +9,7 @@ const initialState = { placeholderData: null, } -function reducer(state, action) { +function reducer(state = initialState, action) { switch (action.type) { case HYDRATE: { return { ...state, ...action.payload } diff --git a/lerna.json b/lerna.json index 5e8cd0b1971d..888c8ad79047 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "12.1.1-canary.14" + "version": "12.1.1-canary.15" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index d0e4f0d7d2a6..3292de58f087 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 5b3017880013..c08eec859989 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "description": "ESLint configuration used by NextJS.", "main": "index.js", "license": "MIT", @@ -9,7 +9,7 @@ "directory": "packages/eslint-config-next" }, "dependencies": { - "@next/eslint-plugin-next": "12.1.1-canary.14", + "@next/eslint-plugin-next": "12.1.1-canary.15", "@rushstack/eslint-patch": "1.0.8", "@typescript-eslint/parser": "5.10.1", "eslint-import-resolver-node": "0.3.4", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 690f94fef416..9f005b2cab54 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "description": "ESLint plugin for NextJS.", "main": "lib/index.js", "license": "MIT", diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index a9a59a5c1067..bcd5b9dd96b0 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index e3565e5c5371..bd43d0da1b8c 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "license": "MIT", "dependencies": { "chalk": "4.1.0", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 3047335bfe99..7168ad6cbd21 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 1e157d63d80d..e4feca6513e1 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 66f42c4541a2..11f9b2204826 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index 01186936731e..f8ea6913c6bb 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index 07ce96320c47..05c9da6d4b0b 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 4e36d27fbd4c..fa54399ed19e 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "private": true, "scripts": { "build-native": "napi build --platform --cargo-name next_swc_napi native", diff --git a/packages/next/package.json b/packages/next/package.json index 91ce61279a02..e4e72d4c296a 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -69,7 +69,7 @@ ] }, "dependencies": { - "@next/env": "12.1.1-canary.14", + "@next/env": "12.1.1-canary.15", "caniuse-lite": "^1.0.30001283", "postcss": "8.4.5", "styled-jsx": "5.0.1", @@ -118,11 +118,11 @@ "@hapi/accept": "5.0.2", "@napi-rs/cli": "2.4.4", "@napi-rs/triples": "1.1.0", - "@next/polyfill-module": "12.1.1-canary.14", - "@next/polyfill-nomodule": "12.1.1-canary.14", - "@next/react-dev-overlay": "12.1.1-canary.14", - "@next/react-refresh-utils": "12.1.1-canary.14", - "@next/swc": "12.1.1-canary.14", + "@next/polyfill-module": "12.1.1-canary.15", + "@next/polyfill-nomodule": "12.1.1-canary.15", + "@next/react-dev-overlay": "12.1.1-canary.15", + "@next/react-refresh-utils": "12.1.1-canary.15", + "@next/swc": "12.1.1-canary.15", "@peculiar/webcrypto": "1.3.1", "@taskr/clear": "1.1.0", "@taskr/esnext": "1.1.0", diff --git a/packages/next/pages/_document.tsx b/packages/next/pages/_document.tsx index adc58bf357df..57a5f4a24af3 100644 --- a/packages/next/pages/_document.tsx +++ b/packages/next/pages/_document.tsx @@ -19,7 +19,7 @@ export { DocumentContext, DocumentInitialProps, DocumentProps } export type OriginProps = { nonce?: string crossOrigin?: string - children?: React.ReactElement + children?: React.ReactNode } type DocumentFiles = { @@ -72,6 +72,10 @@ function getPolyfillScripts(context: HtmlProps, props: OriginProps) { )) } +function hasComponentProps(child: any): child is React.ReactElement { + return !!child && !!child.props +} + function getPreNextWorkerScripts(context: HtmlProps, props: OriginProps) { const { assetPrefix, scriptLoader, crossOrigin, nextScriptWorkers } = context @@ -88,7 +92,8 @@ function getPreNextWorkerScripts(context: HtmlProps, props: OriginProps) { // Check to see if the user has defined their own Partytown configuration const userDefinedConfig = children.find( - (child: React.ReactElement) => + (child) => + hasComponentProps(child) && child?.props?.dangerouslySetInnerHTML?.__html.length && 'data-partytown-config' in child.props ) diff --git a/packages/react-dev-overlay/package.json b/packages/react-dev-overlay/package.json index 19af781d08e3..8fb6398b7134 100644 --- a/packages/react-dev-overlay/package.json +++ b/packages/react-dev-overlay/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-dev-overlay", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "description": "A development-only overlay for developing React applications.", "repository": { "url": "vercel/next.js", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index 5ce3467fc42e..db3894ececfb 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "12.1.1-canary.14", + "version": "12.1.1-canary.15", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/test/production/typescript-basic/app/pages/_document.tsx b/test/production/typescript-basic/app/pages/_document.tsx new file mode 100644 index 000000000000..6916edcdf807 --- /dev/null +++ b/test/production/typescript-basic/app/pages/_document.tsx @@ -0,0 +1,16 @@ +import { Html, Head, Main, NextScript } from 'next/document' + +export default function Document() { + return ( + + + + + + +
+ + + + ) +}