about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/ui/components/columns_area.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-12-09 19:06:13 +0100
committerGitHub <noreply@github.com>2020-12-09 19:06:13 +0100
commitb27d11dd3320cb005561f0bb1b81baecea8a7c43 (patch)
treedba9599f5416483c4a9fcad0002e5a2d6bcd4de1 /app/javascript/flavours/glitch/features/ui/components/columns_area.js
parent25f725d67a6d2542cd586ab7c56baca572eb4f88 (diff)
parent7d0e45a3be167d95cbc4d5f80fa989a9371802ae (diff)
Merge pull request #1472 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/features/ui/components/columns_area.js')
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/columns_area.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/columns_area.js b/app/javascript/flavours/glitch/features/ui/components/columns_area.js
index 729ade212..640be19ab 100644
--- a/app/javascript/flavours/glitch/features/ui/components/columns_area.js
+++ b/app/javascript/flavours/glitch/features/ui/components/columns_area.js
@@ -75,7 +75,9 @@ class ColumnsArea extends ImmutablePureComponent {
   }
 
   componentWillReceiveProps() {
-    this.setState({ shouldAnimate: false });
+    if (typeof this.pendingIndex !== 'number' && this.lastIndex !== getIndex(this.context.router.history.location.pathname)) {
+      this.setState({ shouldAnimate: false });
+    }
   }
 
   componentDidMount() {
@@ -99,8 +101,13 @@ class ColumnsArea extends ImmutablePureComponent {
     if (this.props.singleColumn !== prevProps.singleColumn && !this.props.singleColumn) {
       this.node.addEventListener('wheel', this.handleWheel, supportsPassiveEvents ? { passive: true } : false);
     }
-    this.lastIndex = getIndex(this.context.router.history.location.pathname);
-    this.setState({ shouldAnimate: true });
+
+    const newIndex = getIndex(this.context.router.history.location.pathname);
+
+    if (this.lastIndex !== newIndex) {
+      this.lastIndex = newIndex;
+      this.setState({ shouldAnimate: true });
+    }
   }
 
   componentWillUnmount () {