starting to get rid of componentWillMount per React spec
This commit is contained in:
@@ -1660,14 +1660,17 @@ class EditAccountView extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
let me = Tinode.getMeTopic();
|
||||||
|
let defacs = me.getDefaultAccess();
|
||||||
|
let fnd = Tinode.getFndTopic();
|
||||||
this.state = {
|
this.state = {
|
||||||
address: null,
|
fullName: me.public ? me.public.fn : undefined,
|
||||||
fullName: undefined,
|
avatar: makeImageUrl(me.public ? me.public.photo : null),
|
||||||
avatar: null,
|
address: Tinode.getCurrentUserID(),
|
||||||
login: undefined,
|
auth: defacs.auth,
|
||||||
password: undefined,
|
anon: defacs.anon,
|
||||||
previousOnTags: undefined,
|
tags: fnd.tags(),
|
||||||
tags: []
|
previousOnTags: fnd.onTagsUpdated
|
||||||
};
|
};
|
||||||
|
|
||||||
this.tnNewTags = this.tnNewTags.bind(this);
|
this.tnNewTags = this.tnNewTags.bind(this);
|
||||||
@@ -1677,24 +1680,12 @@ class EditAccountView extends React.Component {
|
|||||||
this.handleTagsUpdated = this.handleTagsUpdated.bind(this);
|
this.handleTagsUpdated = this.handleTagsUpdated.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentDidMount() {
|
||||||
var me = Tinode.getMeTopic();
|
let fnd = Tinode.getFndTopic();
|
||||||
var defacs = me.getDefaultAccess();
|
|
||||||
var fnd = Tinode.getFndTopic();
|
|
||||||
this.setState({
|
|
||||||
fullName: me.public ? me.public.fn : undefined,
|
|
||||||
avatar: makeImageUrl(me.public ? me.public.photo : null),
|
|
||||||
address: Tinode.getCurrentUserID(),
|
|
||||||
auth: defacs.auth,
|
|
||||||
anon: defacs.anon,
|
|
||||||
tags: fnd.tags(),
|
|
||||||
previousOnTags: fnd.onTagsUpdated
|
|
||||||
});
|
|
||||||
fnd.onTagsUpdated = this.tnNewTags;
|
fnd.onTagsUpdated = this.tnNewTags;
|
||||||
if (!fnd.isSubscribed()) {
|
if (!fnd.isSubscribed()) {
|
||||||
var instance = this;
|
fnd.subscribe(fnd.startMetaQuery().withLaterDesc().withTags().build()).catch((err) => {
|
||||||
fnd.subscribe(fnd.startMetaQuery().withLaterDesc().withTags().build()).catch(function(err){
|
this.props.onError(err.message, "err");
|
||||||
instance.props.onError(err.message, "err");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3820,7 +3811,7 @@ class MessagesView extends React.Component {
|
|||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("Other change in topic: " + info.what);
|
console.log("Other change in topic: ", info.what);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user