]> cat aescling's git repositories - mastodon.git/commitdiff
fix: Rerender Bundle on route change (#4120)
authorSorin Davidoi <sorin.davidoi@gmail.com>
Sat, 8 Jul 2017 16:34:55 +0000 (18:34 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 8 Jul 2017 16:34:55 +0000 (18:34 +0200)
app/javascript/mastodon/features/ui/util/react_router_helpers.js

index e33a6df6f49e04ad2dd642976a5154d021af611d..ede578e5600fff1960f5dc9c78932f364b5e499b 100644 (file)
@@ -31,13 +31,11 @@ export class WrappedRoute extends React.Component {
   }
 
   renderComponent = ({ match }) => {
-    this.match = match; // Needed for this.renderBundle
-
-    const { component } = this.props;
+    const { component, content, multiColumn } = this.props;
 
     return (
       <BundleContainer fetchComponent={component} loading={this.renderLoading} error={this.renderError}>
-        {this.renderBundle}
+        {Component => <Component params={match.params} multiColumn={multiColumn}>{content}</Component>}
       </BundleContainer>
     );
   }
@@ -50,12 +48,6 @@ export class WrappedRoute extends React.Component {
     return <BundleColumnError {...props} />;
   }
 
-  renderBundle = (Component) => {
-    const { match: { params }, props: { content, multiColumn } } = this;
-
-    return <Component params={params} multiColumn={multiColumn}>{content}</Component>;
-  }
-
   render () {
     const { component: Component, content, ...rest } = this.props;