Skip to content

Commit bef93f7

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents e21b1ae + 8551428 commit bef93f7

7 files changed

Lines changed: 28 additions & 5 deletions

File tree

src/client.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,14 @@ initSocket();
8686
location: history.location
8787
};
8888

89-
await trigger('fetch', components, triggerLocals);
89+
// Don't fetch data for initial route, server has already done the work:
90+
if (window.__PRELOADED__) {
91+
// Delete initial data so that subsequent data fetches can occur:
92+
delete window.__PRELOADED__;
93+
} else {
94+
// Fetch mandatory data dependencies for 2nd route change onwards:
95+
await trigger('fetch', components, triggerLocals);
96+
}
9097
await trigger('defer', components, triggerLocals);
9198

9299
ReactDOM.hydrate(

src/components/ReduxAsyncConnect/ReduxAsyncConnect.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ class ReduxAsyncConnect extends Component {
1010
static propTypes = {
1111
children: PropTypes.node.isRequired,
1212
history: PropTypes.objectOf(PropTypes.any).isRequired,
13-
location: PropTypes.objectOf(PropTypes.any).isRequired
13+
location: PropTypes.objectOf(PropTypes.any).isRequired,
14+
routes: PropTypes.arrayOf(PropTypes.object).isRequired,
15+
store: PropTypes.objectOf(PropTypes.any).isRequired,
16+
helpers: PropTypes.objectOf(PropTypes.any).isRequired
1417
};
1518

1619
state = {
@@ -25,7 +28,10 @@ class ReduxAsyncConnect extends Component {
2528
const {
2629
history, location, routes, store, helpers
2730
} = this.props;
28-
const navigated = nextProps.location !== location;
31+
const {
32+
location: { pathname, search }
33+
} = nextProps;
34+
const navigated = `${pathname}${search}` !== `${location.pathname}${location.search}`;
2935

3036
if (navigated) {
3137
// save the location so we can render the old screen

src/containers/About/About.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { provideHooks } from 'redial';
44
import MiniInfoBar from 'components/MiniInfoBar/MiniInfoBar';
55
import { isLoaded as isInfoLoaded, load as loadInfo } from 'redux/modules/info';
66

7+
/* eslint-disable max-len */
78
@provideHooks({
89
fetch: ({ store: { dispatch, getState } }) => !isInfoLoaded(getState()) ? dispatch(loadInfo()).catch(() => null) : Promise.resolve()
910
})

src/helpers/Html.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ const Html = ({
5959
<div id="content" dangerouslySetInnerHTML={{ __html: content }} />
6060
{store && (
6161
<script
62-
dangerouslySetInnerHTML={{ __html: `window.__data=${serialize(store.getState())};` }}
62+
dangerouslySetInnerHTML={{
63+
__html: `window.__PRELOADED__=true;window.__data=${serialize(store.getState())};`
64+
}}
6365
charSet="UTF-8"
6466
/>
6567
)}

src/redux/create.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export default function createStore({
4646

4747
if (__CLIENT__ && __DEVTOOLS__) {
4848
const { persistState } = require('redux-devtools');
49-
const DevTools = require('../containers/DevTools/DevTools');
49+
let DevTools = require('../containers/DevTools/DevTools');
50+
DevTools = DevTools.__esModule ? DevTools.default : DevTools;
5051

5152
Array.prototype.push.apply(enhancers, [
5253
window.devToolsExtension ? window.devToolsExtension() : DevTools.instrument(),

webpack/dev.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ const webpackConfig = {
128128
// new webpack.LoaderOptionsPlugin({
129129
// }),
130130

131+
/* wepack build status - show webpack build progress in terminal */
132+
new webpack.ProgressPlugin(),
133+
131134
// hot reload
132135
new webpack.HotModuleReplacementPlugin(),
133136

webpack/prod.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ module.exports = {
169169
extensions: ['.json', '.js', '.jsx']
170170
},
171171
plugins: [
172+
/* wepack build status - show webpack build progress in terminal */
173+
new webpack.ProgressPlugin(),
174+
172175
new CleanPlugin([assetsPath], { root: projectRootPath }),
173176

174177
// css files from the extract-text-plugin loader

0 commit comments

Comments
 (0)