fix late initialization of InfoView component

This commit is contained in:
or-else
2025-09-24 19:38:29 +03:00
parent 679276c2e2
commit c70e5ebf7e
9 changed files with 25 additions and 10 deletions
+11 -2
View File
@@ -134,6 +134,7 @@ class InfoView extends React.Component {
previousSubsUpdated: undefined,
};
this.propsUpdated = this.propsUpdated.bind(this);
this.resetSubs = this.resetSubs.bind(this);
this.resetDesc = this.resetDesc.bind(this);
this.resetTags = this.resetTags.bind(this);
@@ -153,8 +154,7 @@ class InfoView extends React.Component {
this.handleBackNavigate = this.handleBackNavigate.bind(this);
}
// No need to separately handle component mount.
componentDidUpdate(props) {
propsUpdated(props) {
const topic = this.props.tinode.getTopic(props.topic);
if (!topic) {
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() {
const topic = this.props.tinode.getTopic(this.props.topic);
if (!topic) {