Reset chat options when change guild routes (#9743)

This commit is contained in:
Keith Holliday
2018-01-02 22:56:31 -07:00
committed by GitHub
parent 7e241bb76f
commit 6bb535c129
2 changed files with 17 additions and 0 deletions

View File

@@ -57,10 +57,19 @@ export default {
this.currentSearchPosition = newText.length - 1; this.currentSearchPosition = newText.length - 1;
}, },
chat () { chat () {
this.resetDefaults();
this.grabUserNames(); this.grabUserNames();
}, },
}, },
methods: { methods: {
resetDefaults () {
// Mounted is not called when switching between group pages because they have the
// the same parent component. So, reset the data
this.currentSearch = '';
this.searchActive = false;
this.currentSearchPosition = 0;
this.tmpSelections = [];
},
grabUserNames () { grabUserNames () {
let usersThatMessage = groupBy(this.chat, 'user'); let usersThatMessage = groupBy(this.chat, 'user');
for (let userName in usersThatMessage) { for (let userName in usersThatMessage) {

View File

@@ -439,6 +439,14 @@ export default {
}, },
beforeRouteUpdate (to, from, next) { beforeRouteUpdate (to, from, next) {
this.$set(this, 'searchId', to.params.groupId); this.$set(this, 'searchId', to.params.groupId);
// Reset chat
this.newMessage = '';
this.coords = {
TOP: 0,
LEFT: 0,
};
next(); next();
}, },
watch: { watch: {