]> cat aescling's git repositories - mastodon.git/commitdiff
Fix not being able to directly switch between list timelines in web UI (#10973)
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 6 Jun 2019 11:04:49 +0000 (13:04 +0200)
committerGitHub <noreply@github.com>
Thu, 6 Jun 2019 11:04:49 +0000 (13:04 +0200)
app/javascript/mastodon/features/list_timeline/index.js

index b6722e91a76b7ff0bf392c46f02b94b8119f7daa..ad7d16f95ce67482c3fbae2e0f6ccbc23a78125a 100644 (file)
@@ -75,6 +75,23 @@ class ListTimeline extends React.PureComponent {
     this.disconnect = dispatch(connectListStream(id));
   }
 
+  componentWillReceiveProps (nextProps) {
+    const { dispatch } = this.props;
+    const { id } = nextProps.params;
+
+    if (id !== this.props.params.id) {
+      if (this.disconnect) {
+        this.disconnect();
+        this.disconnect = null;
+      }
+
+      dispatch(fetchList(id));
+      dispatch(expandListTimeline(id));
+
+      this.disconnect = dispatch(connectListStream(id));
+    }
+  }
+
   componentWillUnmount () {
     if (this.disconnect) {
       this.disconnect();