about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/ui/components/columns_area.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-12-07 19:36:36 +0100
committerGitHub <noreply@github.com>2020-12-07 19:36:36 +0100
commit9620ee90be7e04b3616ce4b851abb63dbba7af7f (patch)
treef3880b9c8eda7dcc570553eec855080fd122e730 /app/javascript/mastodon/features/ui/components/columns_area.js
parent48bef17cc990afda95c4de657f7643c321e62650 (diff)
Fix unnecessary re-rendering of various components when typing in web UI (#15286)
Diffstat (limited to 'app/javascript/mastodon/features/ui/components/columns_area.js')
-rw-r--r--app/javascript/mastodon/features/ui/components/columns_area.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/mastodon/features/ui/components/columns_area.js
index 36a84fcbf..cf02e9be7 100644
--- a/app/javascript/mastodon/features/ui/components/columns_area.js
+++ b/app/javascript/mastodon/features/ui/components/columns_area.js
@@ -99,8 +99,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 () {