about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-06-06 13:04:49 +0200
committermultiple creatures <dev@multiple-creature.party>2019-11-19 16:39:22 -0600
commit48facd225b90504c1a645888341966af6f726952 (patch)
treef142f8c5c78fc559197e63c32437a995fd4c7a37 /app/javascript
parent2c2b0dcb84420d65ce9ddf9dbc781d457a2915ab (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')
-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 8864b1e0f..0c0bd9499 100644
--- a/app/javascript/flavours/glitch/features/list_timeline/index.js
+++ b/app/javascript/flavours/glitch/features/list_timeline/index.js
@@ -77,6 +77,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();