From c52b8e544770d3e0e2605612cd5defd16d742b82 Mon Sep 17 00:00:00 2001 From: Kirill Konshin Date: Wed, 26 Jul 2017 13:01:09 +0300 Subject: [PATCH] 1.3.1 Fix for #41 --- package-lock.json | 374 +++++++++++++++++++++++++++------------------ package.json | 9 +- pages/_document.js | 50 ------ pages/index.js | 1 - src/index.js | 8 +- 5 files changed, 240 insertions(+), 202 deletions(-) delete mode 100644 pages/_document.js diff --git a/package-lock.json b/package-lock.json index 436d63b..06835ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "next-redux-wrapper", - "version": "1.3.1", + "version": "1.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -453,14 +453,64 @@ } }, "babel-jest": { - "version": "18.0.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-18.0.0.tgz", - "integrity": "sha1-F+u6jLMoXJBthZ6HB+Tnl5X7ZeM=", + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-20.0.3.tgz", + "integrity": "sha1-5KA7E9wQOJ4UD8ZF0J/8TO0wFnE=", "dev": true, "requires": { "babel-core": "6.25.0", - "babel-plugin-istanbul": "3.1.2", - "babel-preset-jest": "18.0.0" + "babel-plugin-istanbul": "4.1.4", + "babel-preset-jest": "20.0.3" + }, + "dependencies": { + "babel-plugin-istanbul": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.4.tgz", + "integrity": "sha1-GN3oS/POMp/d8/QQP66SFFbY5Yc=", + "dev": true, + "requires": { + "find-up": "2.1.0", + "istanbul-lib-instrument": "1.7.4", + "test-exclude": "4.1.1" + } + }, + "babel-plugin-jest-hoist": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-20.0.3.tgz", + "integrity": "sha1-r+3IU70/jcNUjqZx++adA8wsF2c=", + "dev": true + }, + "babel-preset-jest": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-20.0.3.tgz", + "integrity": "sha1-y6yq3stdaJyh4d4TYOv8ZoYsF4o=", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "20.0.3" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "test-exclude": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", + "integrity": "sha512-35+Asrsk3XHJDBgf/VRFexPgh3UyETv8IAn/LRTiZjVy6rjPVqdEk8dJcJYBzl1w0XCJM48lvTy8SfEsCWS4nA==", + "dev": true, + "requires": { + "arrify": "1.0.1", + "micromatch": "2.3.11", + "object-assign": "4.1.1", + "read-pkg-up": "1.0.1", + "require-main-filename": "1.0.1" + } + } } }, "babel-loader": { @@ -492,24 +542,17 @@ "babel-runtime": "6.23.0" } }, - "babel-plugin-istanbul": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-3.1.2.tgz", - "integrity": "sha1-EdWr3hhCXsJLXWSMfgtdJc01SiI=", + "babel-plugin-dynamic-import-node": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-1.0.2.tgz", + "integrity": "sha1-rbW8j0iokxFUA5WunwzD7UsQuy4=", "dev": true, "requires": { - "find-up": "1.1.2", - "istanbul-lib-instrument": "1.7.4", - "object-assign": "4.1.1", - "test-exclude": "3.3.0" + "babel-plugin-syntax-dynamic-import": "6.18.0", + "babel-template": "6.25.0", + "babel-types": "6.25.0" } }, - "babel-plugin-jest-hoist": { - "version": "18.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-18.0.0.tgz", - "integrity": "sha1-QVDnDsq1YObnNErchJSYBy004So=", - "dev": true - }, "babel-plugin-module-resolver": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/babel-plugin-module-resolver/-/babel-plugin-module-resolver-2.6.2.tgz", @@ -539,6 +582,12 @@ "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", "dev": true }, + "babel-plugin-syntax-dynamic-import": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", + "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", + "dev": true + }, "babel-plugin-syntax-exponentiation-operator": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", @@ -580,18 +629,6 @@ "babel-runtime": "6.23.0" } }, - "babel-plugin-transform-class-properties": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.22.0.tgz", - "integrity": "sha1-qnj4E0SVx94GwJcRi6BhhE4dwdg=", - "dev": true, - "requires": { - "babel-helper-function-name": "6.24.1", - "babel-plugin-syntax-class-properties": "6.13.0", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0" - } - }, "babel-plugin-transform-es2015-arrow-functions": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", @@ -857,15 +894,6 @@ "babel-runtime": "6.23.0" } }, - "babel-plugin-transform-react-constant-elements": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-constant-elements/-/babel-plugin-transform-react-constant-elements-6.22.0.tgz", - "integrity": "sha1-SvRW+A0oPovgDwDxKFI1Te+gjuE=", - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, "babel-plugin-transform-react-display-name": { "version": "6.25.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.25.0.tgz", @@ -875,17 +903,6 @@ "babel-runtime": "6.23.0" } }, - "babel-plugin-transform-react-jsx": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-jsx/-/babel-plugin-transform-react-jsx-6.22.0.tgz", - "integrity": "sha1-SFVrfdTD/pfRyUO81U/D8lYcGBc=", - "dev": true, - "requires": { - "babel-helper-builder-react-jsx": "6.24.1", - "babel-plugin-syntax-jsx": "6.18.0", - "babel-runtime": "6.23.0" - } - }, "babel-plugin-transform-react-jsx-self": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-jsx-self/-/babel-plugin-transform-react-jsx-self-6.22.0.tgz", @@ -943,44 +960,6 @@ "babel-types": "6.25.0" } }, - "babel-preset-env": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.2.1.tgz", - "integrity": "sha1-ZZF49U33SnR2X3lr5NKQtb7rP18=", - "dev": true, - "requires": { - "babel-plugin-check-es2015-constants": "6.22.0", - "babel-plugin-syntax-trailing-function-commas": "6.22.0", - "babel-plugin-transform-async-to-generator": "6.24.1", - "babel-plugin-transform-es2015-arrow-functions": "6.22.0", - "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0", - "babel-plugin-transform-es2015-block-scoping": "6.24.1", - "babel-plugin-transform-es2015-classes": "6.24.1", - "babel-plugin-transform-es2015-computed-properties": "6.24.1", - "babel-plugin-transform-es2015-destructuring": "6.23.0", - "babel-plugin-transform-es2015-duplicate-keys": "6.24.1", - "babel-plugin-transform-es2015-for-of": "6.23.0", - "babel-plugin-transform-es2015-function-name": "6.24.1", - "babel-plugin-transform-es2015-literals": "6.22.0", - "babel-plugin-transform-es2015-modules-amd": "6.24.1", - "babel-plugin-transform-es2015-modules-commonjs": "6.24.1", - "babel-plugin-transform-es2015-modules-systemjs": "6.24.1", - "babel-plugin-transform-es2015-modules-umd": "6.24.1", - "babel-plugin-transform-es2015-object-super": "6.24.1", - "babel-plugin-transform-es2015-parameters": "6.24.1", - "babel-plugin-transform-es2015-shorthand-properties": "6.24.1", - "babel-plugin-transform-es2015-spread": "6.22.0", - "babel-plugin-transform-es2015-sticky-regex": "6.24.1", - "babel-plugin-transform-es2015-template-literals": "6.22.0", - "babel-plugin-transform-es2015-typeof-symbol": "6.23.0", - "babel-plugin-transform-es2015-unicode-regex": "6.24.1", - "babel-plugin-transform-exponentiation-operator": "6.24.1", - "babel-plugin-transform-regenerator": "6.22.0", - "browserslist": "1.7.7", - "electron-to-chromium": "1.3.16", - "invariant": "2.2.2" - } - }, "babel-preset-flow": { "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-preset-flow/-/babel-preset-flow-6.23.0.tgz", @@ -990,57 +969,157 @@ "babel-plugin-transform-flow-strip-types": "6.22.0" } }, - "babel-preset-jest": { - "version": "18.0.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-18.0.0.tgz", - "integrity": "sha1-hPr4yj7GWrp9Xj9Zu67ZNaskBJ4=", - "dev": true, - "requires": { - "babel-plugin-jest-hoist": "18.0.0" - } - }, - "babel-preset-react": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-preset-react/-/babel-preset-react-6.22.0.tgz", - "integrity": "sha1-e8l+LXPuxLmA+2tOTgiE6BzNwWU=", - "dev": true, - "requires": { - "babel-plugin-syntax-flow": "6.18.0", - "babel-plugin-syntax-jsx": "6.18.0", - "babel-plugin-transform-flow-strip-types": "6.22.0", - "babel-plugin-transform-react-display-name": "6.25.0", - "babel-plugin-transform-react-jsx": "6.22.0", - "babel-plugin-transform-react-jsx-self": "6.22.0", - "babel-plugin-transform-react-jsx-source": "6.22.0" - } - }, "babel-preset-react-app": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/babel-preset-react-app/-/babel-preset-react-app-2.2.0.tgz", - "integrity": "sha1-MUO88xYEn3i1+dBCL9eCLKRxXKQ=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-react-app/-/babel-preset-react-app-3.0.1.tgz", + "integrity": "sha1-i3RMvkf9V8ho5vkTVSzq4mrjGGA=", "dev": true, "requires": { - "babel-plugin-transform-class-properties": "6.22.0", - "babel-plugin-transform-object-rest-spread": "6.22.0", - "babel-plugin-transform-react-constant-elements": "6.22.0", - "babel-plugin-transform-react-jsx": "6.22.0", + "babel-plugin-dynamic-import-node": "1.0.2", + "babel-plugin-syntax-dynamic-import": "6.18.0", + "babel-plugin-transform-class-properties": "6.24.1", + "babel-plugin-transform-object-rest-spread": "6.23.0", + "babel-plugin-transform-react-constant-elements": "6.23.0", + "babel-plugin-transform-react-jsx": "6.24.1", "babel-plugin-transform-react-jsx-self": "6.22.0", "babel-plugin-transform-react-jsx-source": "6.22.0", - "babel-plugin-transform-regenerator": "6.22.0", - "babel-plugin-transform-runtime": "6.22.0", - "babel-preset-env": "1.2.1", - "babel-preset-react": "6.22.0", - "babel-runtime": "6.22.0" + "babel-plugin-transform-regenerator": "6.24.1", + "babel-plugin-transform-runtime": "6.23.0", + "babel-preset-env": "1.5.2", + "babel-preset-react": "6.24.1" }, "dependencies": { - "babel-runtime": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.22.0.tgz", - "integrity": "sha1-HPi0rGfHek3bDbKuH3TeUqxMphE=", + "babel-plugin-transform-class-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", + "integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=", + "dev": true, + "requires": { + "babel-helper-function-name": "6.24.1", + "babel-plugin-syntax-class-properties": "6.13.0", + "babel-runtime": "6.23.0", + "babel-template": "6.25.0" + } + }, + "babel-plugin-transform-object-rest-spread": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz", + "integrity": "sha1-h11ryb52HFiirj/u5dxIldjH+SE=", + "dev": true, + "requires": { + "babel-plugin-syntax-object-rest-spread": "6.13.0", + "babel-runtime": "6.23.0" + } + }, + "babel-plugin-transform-react-constant-elements": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-constant-elements/-/babel-plugin-transform-react-constant-elements-6.23.0.tgz", + "integrity": "sha1-LxGb9NLN1F65uqrldAU8YE9hR90=", + "dev": true, + "requires": { + "babel-runtime": "6.23.0" + } + }, + "babel-plugin-transform-react-jsx": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-jsx/-/babel-plugin-transform-react-jsx-6.24.1.tgz", + "integrity": "sha1-hAoCjn30YN/DotKfDA2R9jduZqM=", + "dev": true, + "requires": { + "babel-helper-builder-react-jsx": "6.24.1", + "babel-plugin-syntax-jsx": "6.18.0", + "babel-runtime": "6.23.0" + } + }, + "babel-plugin-transform-regenerator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.24.1.tgz", + "integrity": "sha1-uNowWtQ8PJm0hI5P5AN7dw0jxBg=", "dev": true, "requires": { - "core-js": "2.4.1", - "regenerator-runtime": "0.10.5" + "regenerator-transform": "0.9.11" + } + }, + "babel-plugin-transform-runtime": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz", + "integrity": "sha1-iEkNRGUC6puOfvsP4J7E2ZR5se4=", + "dev": true, + "requires": { + "babel-runtime": "6.23.0" + } + }, + "babel-preset-env": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.5.2.tgz", + "integrity": "sha1-zUrpCm6Utwn5c3SzPl+LmDVWre8=", + "dev": true, + "requires": { + "babel-plugin-check-es2015-constants": "6.22.0", + "babel-plugin-syntax-trailing-function-commas": "6.22.0", + "babel-plugin-transform-async-to-generator": "6.24.1", + "babel-plugin-transform-es2015-arrow-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoping": "6.24.1", + "babel-plugin-transform-es2015-classes": "6.24.1", + "babel-plugin-transform-es2015-computed-properties": "6.24.1", + "babel-plugin-transform-es2015-destructuring": "6.23.0", + "babel-plugin-transform-es2015-duplicate-keys": "6.24.1", + "babel-plugin-transform-es2015-for-of": "6.23.0", + "babel-plugin-transform-es2015-function-name": "6.24.1", + "babel-plugin-transform-es2015-literals": "6.22.0", + "babel-plugin-transform-es2015-modules-amd": "6.24.1", + "babel-plugin-transform-es2015-modules-commonjs": "6.24.1", + "babel-plugin-transform-es2015-modules-systemjs": "6.24.1", + "babel-plugin-transform-es2015-modules-umd": "6.24.1", + "babel-plugin-transform-es2015-object-super": "6.24.1", + "babel-plugin-transform-es2015-parameters": "6.24.1", + "babel-plugin-transform-es2015-shorthand-properties": "6.24.1", + "babel-plugin-transform-es2015-spread": "6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "6.24.1", + "babel-plugin-transform-es2015-template-literals": "6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "6.23.0", + "babel-plugin-transform-es2015-unicode-regex": "6.24.1", + "babel-plugin-transform-exponentiation-operator": "6.24.1", + "babel-plugin-transform-regenerator": "6.24.1", + "browserslist": "2.2.2", + "invariant": "2.2.2", + "semver": "5.4.1" + } + }, + "babel-preset-react": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-react/-/babel-preset-react-6.24.1.tgz", + "integrity": "sha1-umnfrqRfw+xjm2pOzqbhdwLJE4A=", + "dev": true, + "requires": { + "babel-plugin-syntax-jsx": "6.18.0", + "babel-plugin-transform-react-display-name": "6.25.0", + "babel-plugin-transform-react-jsx": "6.24.1", + "babel-plugin-transform-react-jsx-self": "6.22.0", + "babel-plugin-transform-react-jsx-source": "6.22.0", + "babel-preset-flow": "6.23.0" + } + }, + "browserslist": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.2.2.tgz", + "integrity": "sha512-MejxGMNIeIqzgaMKVYfFTWHinrwZOnWMXteN9VlHinTd13/0aDmXY9uyRqNsCTnVxqRmrjQFcXI7cy0q9K1IYg==", + "dev": true, + "requires": { + "caniuse-lite": "1.0.30000706", + "electron-to-chromium": "1.3.16" + } + }, + "regenerator-transform": { + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.9.11.tgz", + "integrity": "sha1-On0GdSDLe3F2dp61/4aGkb7+EoM=", + "dev": true, + "requires": { + "babel-runtime": "6.23.0", + "babel-types": "6.25.0", + "private": "0.1.7" } } } @@ -1355,6 +1434,12 @@ "integrity": "sha1-4rXwRgVzy8yIoJhfXM7QjxYXxvU=", "dev": true }, + "caniuse-lite": { + "version": "1.0.30000706", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000706.tgz", + "integrity": "sha1-vFmrxBun1KNjTdqVvv3tYRTh8k4=", + "dev": true + }, "case-sensitive-paths-webpack-plugin": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.0.0.tgz", @@ -5328,6 +5413,18 @@ "integrity": "sha1-T39sEsPn3kLzRZkqPFGCNvoeytM=", "dev": true }, + "react-dom": { + "version": "15.6.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-15.6.1.tgz", + "integrity": "sha1-LLDtQZEDjlPCCes6eaI+Kkz5lHA=", + "dev": true, + "requires": { + "fbjs": "0.8.12", + "loose-envify": "1.3.1", + "object-assign": "4.1.1", + "prop-types": "15.5.10" + } + }, "react-hot-loader": { "version": "3.0.0-beta.7", "resolved": "https://registry.npmjs.org/react-hot-loader/-/react-hot-loader-3.0.0-beta.7.tgz", @@ -6108,19 +6205,6 @@ "integrity": "sha1-5GwNqsuyuKmLmwzqD0BSEFgX7Vw=", "dev": true }, - "test-exclude": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-3.3.0.tgz", - "integrity": "sha1-ehfKEjmYjJg2ewYhRW27fUvDiXc=", - "dev": true, - "requires": { - "arrify": "1.0.1", - "micromatch": "2.3.11", - "object-assign": "4.1.1", - "read-pkg-up": "1.0.1", - "require-main-filename": "1.0.1" - } - }, "thenify": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz", diff --git a/package.json b/package.json index 970e6c5..fddc323 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "next-redux-wrapper", - "version": "1.3.0", + "version": "1.3.1", "description": "Redux wrapper for Next.js", "main": "src/index.js", "scripts": { @@ -9,11 +9,12 @@ }, "author": "Kirill Konshin", "devDependencies": { - "babel-jest": "^18.0.0", - "babel-preset-react-app": "^2.1.0", + "babel-jest": "^20.0.3", + "babel-preset-react-app": "^3.0.1", "jest": "^20.0.4", - "next": "^2.0.0-beta.24", + "next": "^2.4.3", "react": "^15.4.2", + "react-dom": "^15.6.1", "react-redux": "^5.0.2", "react-test-renderer": "^15.4.2", "redux": "^3.6.0", diff --git a/pages/_document.js b/pages/_document.js deleted file mode 100644 index d57fa03..0000000 --- a/pages/_document.js +++ /dev/null @@ -1,50 +0,0 @@ -import React from "react"; -import wrapper from "../src"; -import {makeStore} from "../components/store"; -import Document, {Head, Main, NextScript} from "next/document"; - -class MyDocument extends Document { - - static async getInitialProps(ctx) { - - const props = await Document.getInitialProps(ctx); - const {store, isServer, pathname, query} = ctx; - - console.log(MyDocument.name, '- 2. Cmp.getInitialProps uses the store to dispatch things, pathname', pathname, 'query', query); - - if (isServer) { - - return new Promise((res) => { - setTimeout(() => { - store.dispatch({type: 'TACK', payload: 'server'}); - res(props); - }, 200); - }); - - } - - store.dispatch({type: 'TACK', payload: 'client'}); - - return props; - - } - - render() { - return ( - - - - - - _document view of Redux tack: {this.props.tack} -- note the difference below -
- - - - ) - } -} - -MyDocument = wrapper(makeStore, state => state)(MyDocument); - -export default MyDocument; \ No newline at end of file diff --git a/pages/index.js b/pages/index.js index a1b575e..c1d9531 100644 --- a/pages/index.js +++ b/pages/index.js @@ -33,7 +33,6 @@ class Page extends React.Component { return (
Redux tick: {this.props.tick} (this page)
-
Redux tack: {this.props.tack} (_document)
Custom: {this.props.custom}
Navigate
diff --git a/src/index.js b/src/index.js index 5cd7a43..6b55a75 100644 --- a/src/index.js +++ b/src/index.js @@ -7,12 +7,12 @@ var Provider = ReactRedux.Provider; var _Promise; var _debug = false; var skipMerge = ['initialState', 'initialProps', 'isServer', 'store']; -var connectArgs = ['mapStateToProps', 'mapDispatchToProps', 'mergedProps', 'connectOptions']; var DEFAULT_KEY = '__NEXT_REDUX_STORE__'; function initStore(makeStore, initialState, context, config) { var req = context.req; - var isServer = !!req && typeof window === 'undefined'; + var isBrowser = typeof window !== 'undefined'; + var isServer = !!req && !isBrowser; var storeKey = config.storeKey; var options = Object.assign({}, config, { @@ -29,6 +29,10 @@ function initStore(makeStore, initialState, context, config) { return req._store; } + if (!isBrowser) { + throw new Error("WithRedux has to be used only for top level pages, all other components has to be wrapped in connect"); + } + // Memoize store if client if (!window[storeKey]) { window[storeKey] = makeStore(initialState, options);