fix late initialization of InfoView component
This commit is contained in:
+11
-2
@@ -134,6 +134,7 @@ class InfoView extends React.Component {
|
|||||||
previousSubsUpdated: undefined,
|
previousSubsUpdated: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.propsUpdated = this.propsUpdated.bind(this);
|
||||||
this.resetSubs = this.resetSubs.bind(this);
|
this.resetSubs = this.resetSubs.bind(this);
|
||||||
this.resetDesc = this.resetDesc.bind(this);
|
this.resetDesc = this.resetDesc.bind(this);
|
||||||
this.resetTags = this.resetTags.bind(this);
|
this.resetTags = this.resetTags.bind(this);
|
||||||
@@ -153,8 +154,7 @@ class InfoView extends React.Component {
|
|||||||
this.handleBackNavigate = this.handleBackNavigate.bind(this);
|
this.handleBackNavigate = this.handleBackNavigate.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to separately handle component mount.
|
propsUpdated(props) {
|
||||||
componentDidUpdate(props) {
|
|
||||||
const topic = this.props.tinode.getTopic(props.topic);
|
const topic = this.props.tinode.getTopic(props.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return;
|
return;
|
||||||
@@ -176,6 +176,15 @@ class InfoView extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Must provide this for lazy loaded components.
|
||||||
|
componentDidMount() {
|
||||||
|
this.propsUpdated(this.props);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(props) {
|
||||||
|
this.propsUpdated(props);
|
||||||
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
const topic = this.props.tinode.getTopic(this.props.topic);
|
const topic = this.props.tinode.getTopic(this.props.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -185,6 +185,7 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
previousMetaDesc: undefined,
|
previousMetaDesc: undefined,
|
||||||
previousSubsUpdated: undefined
|
previousSubsUpdated: undefined
|
||||||
};
|
};
|
||||||
|
this.propsUpdated = this.propsUpdated.bind(this);
|
||||||
this.resetSubs = this.resetSubs.bind(this);
|
this.resetSubs = this.resetSubs.bind(this);
|
||||||
this.resetDesc = this.resetDesc.bind(this);
|
this.resetDesc = this.resetDesc.bind(this);
|
||||||
this.resetTags = this.resetTags.bind(this);
|
this.resetTags = this.resetTags.bind(this);
|
||||||
@@ -203,7 +204,7 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
this.handleContextMenu = this.handleContextMenu.bind(this);
|
this.handleContextMenu = this.handleContextMenu.bind(this);
|
||||||
this.handleBackNavigate = this.handleBackNavigate.bind(this);
|
this.handleBackNavigate = this.handleBackNavigate.bind(this);
|
||||||
}
|
}
|
||||||
componentDidUpdate(props) {
|
propsUpdated(props) {
|
||||||
const topic = this.props.tinode.getTopic(props.topic);
|
const topic = this.props.tinode.getTopic(props.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return;
|
return;
|
||||||
@@ -223,6 +224,12 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
this.resetTags(topic);
|
this.resetTags(topic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
componentDidMount() {
|
||||||
|
this.propsUpdated(this.props);
|
||||||
|
}
|
||||||
|
componentDidUpdate(props) {
|
||||||
|
this.propsUpdated(props);
|
||||||
|
}
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
const topic = this.props.tinode.getTopic(this.props.topic);
|
const topic = this.props.tinode.getTopic(this.props.topic);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -3496,7 +3496,6 @@ class TopicMe extends _topic_js__WEBPACK_IMPORTED_MODULE_2__["default"] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_processMetaDesc(desc) {
|
_processMetaDesc(desc) {
|
||||||
console.log("_processMetaDesc", desc);
|
|
||||||
const turnOff = desc.acs && !desc.acs.isPresencer() && this.acs && this.acs.isPresencer();
|
const turnOff = desc.acs && !desc.acs.isPresencer() && this.acs && this.acs.isPresencer();
|
||||||
(0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.mergeObj)(this, desc);
|
(0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.mergeObj)(this, desc);
|
||||||
this._tinode._db.updTopic(this);
|
this._tinode._db.updTopic(this);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user