]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix not being able to directly switch between list timelines in web UI
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 6 Jun 2019 11:04:49 +0000 (13:04 +0200)
committerThibaut Girka <thib@sitedethib.com>
Fri, 7 Jun 2019 15:39:46 +0000 (17:39 +0200)
Port 5bfd802c571a2793bb59ba4540407a6147e82f88 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
app/javascript/flavours/glitch/features/list_timeline/index.js

index ef829b937c40685a52b869e73abce67143c670ab..0405073c5ad9d7dc461fad29b5b79b64732eb8a5 100644 (file)
@@ -75,6 +75,23 @@ export default 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();