Fix history not loading on channel switch

This commit is contained in:
Pavel Djundik 2018-07-25 14:12:28 +03:00 committed by Pavel Djundik
parent fea6fff13a
commit bd57c6d620

View file

@ -152,6 +152,13 @@ export default {
watch: { watch: {
"channel.id"() { "channel.id"() {
this.channel.scrolledToBottom = true; this.channel.scrolledToBottom = true;
// Re-add the intersection observer to trigger the check again on channel switch
// Otherwise if last channel had the button visible, switching to a new channel won't trigger the history
if (this.historyObserver) {
this.historyObserver.unobserve(this.$refs.loadMoreButton);
this.historyObserver.observe(this.$refs.loadMoreButton);
}
}, },
"channel.messages"() { "channel.messages"() {
this.keepScrollPosition(); this.keepScrollPosition();
@ -253,7 +260,7 @@ export default {
return; return;
} }
entry.target.click(); this.onShowMoreClick();
}); });
}, },
keepScrollPosition() { keepScrollPosition() {