about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorMitarashiDango <MitarashiDango@users.noreply.github.com>2017-08-31 00:30:25 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-08-30 17:30:25 +0200
commitfec13735a76dd011a60d73ddba235797f79ecb0d (patch)
treee58e8dfe1cf5c71c27ef2d078ffe2068d86a2db9 /app/javascript
parent7b8f26284072120701289f90bc6602ce918e4304 (diff)
error fixed (when loading pages in single column mode.) (#4746)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/features/ui/components/columns_area.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/mastodon/features/ui/components/columns_area.js
index 2dd71dbc6..a4c60d968 100644
--- a/app/javascript/mastodon/features/ui/components/columns_area.js
+++ b/app/javascript/mastodon/features/ui/components/columns_area.js
@@ -48,18 +48,31 @@ export default class ColumnsArea extends ImmutablePureComponent {
   }
 
   componentDidMount() {
-    this.node.addEventListener('wheel', this.handleWheel,  detectPassiveEvents ? { passive: true } : false);
+    if (!this.props.singleColumn) {
+      this.node.addEventListener('wheel', this.handleWheel,  detectPassiveEvents ? { passive: true } : false);
+    }
     this.lastIndex = getIndex(this.context.router.history.location.pathname);
     this.setState({ shouldAnimate: true });
   }
 
-  componentDidUpdate() {
+  componentWillUpdate(nextProps) {
+    if (this.props.singleColumn !== nextProps.singleColumn && nextProps.singleColumn) {
+      this.node.removeEventListener('wheel', this.handleWheel);
+    }
+  }
+
+  componentDidUpdate(prevProps) {
+    if (this.props.singleColumn !== prevProps.singleColumn && !this.props.singleColumn) {
+      this.node.addEventListener('wheel', this.handleWheel,  detectPassiveEvents ? { passive: true } : false);
+    }
     this.lastIndex = getIndex(this.context.router.history.location.pathname);
     this.setState({ shouldAnimate: true });
   }
 
   componentWillUnmount () {
-    this.node.removeEventListener('wheel', this.handleWheel);
+    if (!this.props.singleColumn) {
+      this.node.removeEventListener('wheel', this.handleWheel);
+    }
   }
 
   handleChildrenContentChange() {