Updated list_timeline to check for new list id on to reload new list
added check in componentWillReceiveProps for new params.id for updating list fixes: #53
This commit is contained in:
parent
efb3ac7ac3
commit
1054e0c51b
|
@ -43,8 +43,22 @@ class ListTimeline extends React.PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
|
this.handleConnect(this.props.params.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
this.handleDisconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
if (nextProps.params.id !== this.props.params.id) {
|
||||||
|
this.handleDisconnect();
|
||||||
|
this.handleConnect(nextProps.params.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleConnect(id) {
|
||||||
const { dispatch } = this.props;
|
const { dispatch } = this.props;
|
||||||
const { id } = this.props.params;
|
|
||||||
|
|
||||||
dispatch(fetchList(id));
|
dispatch(fetchList(id));
|
||||||
dispatch(expandListTimeline(id));
|
dispatch(expandListTimeline(id));
|
||||||
|
@ -52,7 +66,7 @@ class ListTimeline extends React.PureComponent {
|
||||||
this.disconnect = dispatch(connectListStream(id));
|
this.disconnect = dispatch(connectListStream(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
handleDisconnect() {
|
||||||
if (this.disconnect) {
|
if (this.disconnect) {
|
||||||
this.disconnect();
|
this.disconnect();
|
||||||
this.disconnect = null;
|
this.disconnect = null;
|
||||||
|
|
Loading…
Reference in New Issue