]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix unnecessary re-rendering of various components when typing in web UI
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 7 Dec 2020 18:36:36 +0000 (19:36 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Wed, 9 Dec 2020 14:11:38 +0000 (15:11 +0100)
Partially port 9620ee90be7e04b3616ce4b851abb63dbba7af7f to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/features/ui/components/columns_area.js

index 729ade212800cd5ac90ba4dc13811b875a3f4e7c..5c2e387a5f29c42f963f3362b567845b44134948 100644 (file)
@@ -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 () {