diff --git a/index.html b/index.html index daee8711..abb4f0da 100644 --- a/index.html +++ b/index.html @@ -652,11 +652,11 @@ }; }, - componentWillReceiveProps: function(newProps) { + componentWillReceiveProps: function(nextProps) { // If text has changed while in read mode, update text and discard changes. // Ignore update if in edit mode. - if (this.props.text != newProps.text && !this.state.active) { - this.setState({text: newProps.text || ""}); + if (this.props.text != nextProps.text && !this.state.active) { + this.setState({text: nextProps.text || ""}); } }, @@ -904,12 +904,12 @@ }; }, - componentWillReceiveProps: function(newProps) { + componentWillReceiveProps: function(nextProps) { this.setState({ - sortedChips: this.sortChips(newProps.chips, newProps.required), - chipIndex: this.indexChips(newProps.chips) + sortedChips: this.sortChips(nextProps.chips, nextProps.required), + chipIndex: this.indexChips(nextProps.chips) }); - if (newProps.chips.length > this.props.chips.length) { + if (nextProps.chips.length > this.props.chips.length) { // Chip added: clear input. this.setState({input: ''}); } @@ -1485,8 +1485,8 @@ }; }, - componentWillReceiveProps: function(newProps) { - this.setState({show: !(!newProps.level)}); + componentWillReceiveProps: function(nextProps) { + this.setState({show: !(!nextProps.level)}); }, hide: function() { @@ -1855,8 +1855,7 @@ var ContactsView = React.createClass({ getInitialState: function() { return { - contactList: this.prepareContactList(), - initialLoadComplete: false + contactList: this.prepareContactList() }; }, componentWillMount: function() { @@ -1866,13 +1865,27 @@ me.onSubsUpdated = this.tnMeSubsUpdated; } }, + + componentWillReceiveProps: function(nextProps) { + if (this.props.topicSelected != nextProps.topicSelected) { + // If topicSelecetd is changed externally, update the + // topic with online status and access mode. + for (var i=0;i 1) { var tp = Tinode.getTopicType(hash.path[1]); if (tp) { - console.log("setting topicSelected to", hash.path[1]); this.setState({topicSelected: hash.path[1]}); } else { - console.log("setting topicSelected to null"); this.setState({topicSelected: null}); } } @@ -4087,7 +4094,9 @@ }, handleTopicSelectedOnline: function(online) { - this.setState({topicSelectedOnline: online}); + if (typeof online == 'boolean') { + this.setState({topicSelectedOnline: online}); + } }, // Permissions of a currently selected topic have been updated by server. handleTopicSelectedAcs: function(acs) { @@ -4191,7 +4200,6 @@ }, // Create of a new topic. New P2P topic requires peer's name. handleNewTopicRequest: function(peerName, pub, priv, tags) { - console.log("handleNewTopicRequest"); var instance = this; var topic = peerName ? Tinode.newTopicWith(peerName) : Tinode.newTopic(); var query = topic.startMetaQuery().withDesc().withSub().withData();