request messages when subscribing to a new topic

This commit is contained in:
or-else
2019-04-08 16:11:43 +03:00
parent 4b561de04c
commit e73c41f3c6
5 changed files with 22 additions and 11 deletions
+9 -3
View File
@@ -2716,16 +2716,22 @@ var MessagesView = function (_React$Component) {
}
if (topic && !topic.isSubscribed() && this.props.ready && (this.state.topic != prevState.topic || !prevProps.ready)) {
var newTopic = this.props.newTopicParams && this.props.newTopicParams._topicName == this.props.topic;
var getQuery = topic.startMetaQuery().withLaterDesc().withLaterSub();
if (this.state.isReader) {
getQuery = getQuery.withLaterData(_config_js__WEBPACK_IMPORTED_MODULE_12__["MESSAGES_PAGE"]).withLaterDel();
if (this.state.isReader || newTopic) {
getQuery = getQuery.withLaterData(_config_js__WEBPACK_IMPORTED_MODULE_12__["MESSAGES_PAGE"]);
if (this.state.isReader) {
getQuery = getQuery.withLaterDel();
}
this.setState({
fetchingMessages: true
});
}
var setQuery = this.props.newTopicParams && this.props.newTopicParams._topicName == this.props.topic ? this.props.newTopicParams : undefined;
var setQuery = newTopic ? this.props.newTopicParams : undefined;
topic.subscribe(getQuery.build(), setQuery).then(function (ctrl) {
if (_this2.state.topic != ctrl.topic) {
_this2.setState({