diff --git a/v1/lib/server/__tests__/__snapshots__/utils.test.js.snap b/v1/lib/server/__tests__/__snapshots__/utils.test.js.snap index a74d43712d..6ad028dea8 100644 --- a/v1/lib/server/__tests__/__snapshots__/utils.test.js.snap +++ b/v1/lib/server/__tests__/__snapshots__/utils.test.js.snap @@ -7,6 +7,7 @@ exports[`server utils autoprefix css 1`] = ` * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + .hljs { margin-left: -15px; margin-right: -15px; diff --git a/v2/lib/load/routes.js b/v2/lib/load/routes.js index 5080a451c0..cafd575a24 100644 --- a/v2/lib/load/routes.js +++ b/v2/lib/load/routes.js @@ -17,7 +17,9 @@ async function genRoutesConfig({ path: ${JSON.stringify(permalink)}, exact: true, component: Loadable({ - loader: () => import(${JSON.stringify(source)}), + loader: () => import(/* webpackPrefetch: true */ ${JSON.stringify( + source, + )}), loading: Loading, render(loaded, props) { let Content = loaded.default; @@ -38,7 +40,9 @@ async function genRoutesConfig({ path: ${JSON.stringify(permalink)}, exact: true, component: Loadable({ - loader: () => import(${JSON.stringify(source)}), + loader: () => import(/* webpackPrefetch: true */ ${JSON.stringify( + source, + )}), loading: Loading, render(loaded, props) { let Content = loaded.default; @@ -63,7 +67,12 @@ async function genRoutesConfig({ component: Loadable.Map({ loader: { ${posts - .map((p, i) => `post${i}: () => import(${JSON.stringify(p.source)})`) + .map( + (p, i) => + `post${i}: () => import(/* webpackPrefetch: true */ ${JSON.stringify( + p.source, + )})`, + ) .join(',\n\t\t\t\t')} }, loading: Loading, @@ -86,7 +95,9 @@ async function genRoutesConfig({ path: ${JSON.stringify(permalink)}, exact: true, component: Loadable({ - loader: () => import(${JSON.stringify(source)}), + loader: () => import(/* webpackPrefetch: true */ ${JSON.stringify( + source, + )}), loading: Loading, render(loaded, props) { let MarkdownContent = loaded.default; diff --git a/v2/website/pages/index.js b/v2/website/pages/index.js index 32ec9576a1..4318339649 100644 --- a/v2/website/pages/index.js +++ b/v2/website/pages/index.js @@ -116,13 +116,17 @@ export default class Home extends React.Component { } componentDidMount() { - window.setInterval(() => { + this.interval = setInterval(() => { this.setState(prevState => ({ featureIndex: (prevState.featureIndex + 1) % FEATURES.length, })); }, 3000); } + componentWillUnmount() { + clearInterval(this.interval); + } + render() { return (
@@ -205,8 +209,8 @@ export default class Home extends React.Component { )}>
- {QUOTES.map(quote => ( -
+ {QUOTES.map((quote, index) => ( +