bug fix: crashes when switching topics with open <InfoView>
This commit is contained in:
+7
-10
@@ -2501,6 +2501,7 @@
|
|||||||
var InfoView = React.createClass({
|
var InfoView = React.createClass({
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
|
topic: null,
|
||||||
owner: false,
|
owner: false,
|
||||||
admin: false,
|
admin: false,
|
||||||
sharer: false,
|
sharer: false,
|
||||||
@@ -2539,6 +2540,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.previousMetaDesc != topic.onMetaDesc) {
|
||||||
this.previousMetaDesc = topic.onMetaDesc;
|
this.previousMetaDesc = topic.onMetaDesc;
|
||||||
topic.onMetaDesc = this.onMetaDesc;
|
topic.onMetaDesc = this.onMetaDesc;
|
||||||
|
|
||||||
@@ -2551,12 +2553,10 @@
|
|||||||
} else {
|
} else {
|
||||||
this.previousTagsUpdated = undefined;
|
this.previousTagsUpdated = undefined;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.resetInfoView(topic, props, true);
|
if (this.state.topic != props.topic) {
|
||||||
},
|
this.setState({topic: props.topic});
|
||||||
|
|
||||||
resetInfoView: function(topic, props, forced) {
|
|
||||||
if (forced || this.props.topic != props.topic) {
|
|
||||||
this.resetDesc(topic, props);
|
this.resetDesc(topic, props);
|
||||||
this.resetSubs(topic, props);
|
this.resetSubs(topic, props);
|
||||||
|
|
||||||
@@ -2571,17 +2571,14 @@
|
|||||||
if (!topic) {
|
if (!topic) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.setState({topic: null});
|
||||||
topic.onMetaDesc = this.previousMetaDesc;
|
topic.onMetaDesc = this.previousMetaDesc;
|
||||||
topic.onSubsUpdated = this.previousSubsUpdated;
|
topic.onSubsUpdated = this.previousSubsUpdated;
|
||||||
topic.onTagsUpdated = this.previousTagsUpdated;
|
topic.onTagsUpdated = this.previousTagsUpdated;
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(nextProps) {
|
componentWillReceiveProps: function(nextProps) {
|
||||||
var topic = Tinode.getTopic(nextProps.topic);
|
this.initInfoView(nextProps);
|
||||||
if (!topic) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.resetInfoView(topic, nextProps);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
resetSubs: function(topic, props) {
|
resetSubs: function(topic, props) {
|
||||||
|
|||||||
Reference in New Issue
Block a user