about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/list_timeline
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-06-06 13:04:49 +0200
committerThibaut Girka <thib@sitedethib.com>2019-06-07 17:39:46 +0200
commitaec3fa35fda50e7f618dcf8b8f14e78a995583f4 (patch)
treeb5d615001967cf102e88fac86b8ddb3227600109 /app/javascript/flavours/glitch/features/list_timeline
parent417989ae34594df3d6ce720dfe70132158b6da28 (diff)
[Glitch] Fix not being able to directly switch between list timelines in web UI
Port 5bfd802c571a2793bb59ba4540407a6147e82f88 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/list_timeline')
-rw-r--r--app/javascript/flavours/glitch/features/list_timeline/index.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/list_timeline/index.js b/app/javascript/flavours/glitch/features/list_timeline/index.js
index ef829b937..0405073c5 100644
--- a/app/javascript/flavours/glitch/features/list_timeline/index.js
+++ b/app/javascript/flavours/glitch/features/list_timeline/index.js
@@ -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();