diff --git a/src/app/components/app/index.js b/src/app/components/app/index.js index 1f73c4d48..036e9acb6 100644 --- a/src/app/components/app/index.js +++ b/src/app/components/app/index.js @@ -91,7 +91,9 @@ const App = React.createClass({ this.getViewportDimensions(); /* Get dimensions of viewport to calculate mousePosition and scrollPosition (for example) */ - window.addEventListener('scroll', this.getDocumentScrollPosition); + if (!post || !caseStudy) { + window.addEventListener('scroll', this.getDocumentScrollPosition); + } /* Get new dimensions when device orientationchange etc */ window.addEventListener('resize', this.getViewportDimensions); diff --git a/src/app/components/post/index.js b/src/app/components/post/index.js index 7d267b47b..0ea2d17e1 100644 --- a/src/app/components/post/index.js +++ b/src/app/components/post/index.js @@ -20,6 +20,9 @@ import ScrollWrapper from 'app/components/scroll-wrapper'; const PagePost = React.createClass({ mixins: [getScrollTrackerMixin('post')], + shouldComponentUpdate(nextProps, nextState) { + return !this.props.loaded; + }, render() { const { post, footer, studios, currentPage, documentScrollPosition, viewportDimensions } = this.props; const category = get(post, '_embedded.wp:term.0.0', []); diff --git a/src/app/lib/module-renderer.js b/src/app/lib/module-renderer.js index 10dcb9ec6..4a49e7297 100644 --- a/src/app/lib/module-renderer.js +++ b/src/app/lib/module-renderer.js @@ -112,10 +112,7 @@ function renderVideo(moduleData, index, options) { } function renderCode(moduleData, index, options) { - var code = get(moduleData, 'attr.body.value').replace(/(?:\r\n|\r|\n)/g, '
').replace(/ /g, ' ').replace('Button', ' Button '); - return ( - - ); + return } function renderModules(options) {