Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Commit

Permalink
Added global npm dependencies to package.json too. Don't show check…
Browse files Browse the repository at this point in the history
…sum error in production.
  • Loading branch information
RickWong committed Mar 16, 2015
1 parent 23f171f commit ab0ce4f
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 43 deletions.
166 changes: 134 additions & 32 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-isomorphic-starterkit",
"description": "Isomorphic starterkit with server-side React rendering.",
"version": "1.3.0",
"version": "1.3.1",
"license": "BSD-3",
"repository": {
"type": "git",
Expand All @@ -20,7 +20,7 @@
"main": "dist/index",
"scripts": {
"start": "supervisor dist/server",
"localhost": "sleep 1; which open && open http://localhost:8000",
"localhost": "sleep 2; which open && open http://localhost:8000",
"browser": "sleep 6; concurrent --kill-others 'npm run start' 'npm run localhost'",
"build-server": "webpack --verbose --colors --display-error-details --config webpack.server.js",
"build-client": "webpack --verbose --colors --display-error-details --config webpack.client.js",
Expand All @@ -34,16 +34,18 @@
"hapi": "8.4.0",
"react": "0.12.2",
"react-a11y": "0.0.6",
"react-inline-css": "1.0.2",
"react-inline-css": "1.1.1",
"react-router": "0.12.4",
"superagent": "1.1.0"
},
"devDependencies": {
"babel-core": "4.7.12",
"babel-loader": "4.1.0",
"babel-loader": "4.2.0",
"babel-runtime": "4.7.12",
"concurrently": "0.0.5",
"json-loader": "0.5.1",
"react-hot-loader": "1.2.3",
"supervisor": "0.6.0",
"webpack": "1.7.3",
"webpack-dev-server": "1.7.0"
},
Expand Down
11 changes: 7 additions & 4 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ Router.run(routes, Router.HistoryLocation, (Handler) => {
});
});


/**
* Detect whether the server-side render has been discarded due to an invalid checksum.
*/
const reactRoot = window.document.getElementById("react-root");
if (process.env.NODE_ENV !== "production") {
const reactRoot = window.document.getElementById("react-root");

if (!reactRoot || !reactRoot.firstChild ||
!reactRoot.firstChild.attributes["data-react-checksum"]) {
console.error("Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.");
if (!reactRoot || !reactRoot.firstChild ||
!reactRoot.firstChild.attributes["data-react-checksum"]) {
console.error("Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.");
}
}
Loading

0 comments on commit ab0ce4f

Please sign in to comment.