[Glitch] Fix not being able to directly switch between list timelines in web UI

Port a36e4db82f to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
lolsob-rspec
Eugen Rochko 2019-06-06 13:04:49 +02:00 committed by Thibaut Girka
parent c15ff07c69
commit f8e1c0da75
1 changed files with 17 additions and 0 deletions

View 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();