mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
fix: reset loaded matches when the user switch tabs
This commit is contained in:
parent
d50f562ee4
commit
fc11c4909d
2 changed files with 12 additions and 1 deletions
|
|
@ -50,6 +50,10 @@ export const mutations = {
|
|||
state.champions.list = champions
|
||||
state.champions.championsLoaded = true
|
||||
},
|
||||
KEEP_LAST_X_MATCHES(state, number) {
|
||||
state.overview.matchIndex = number
|
||||
state.overview.matches = state.overview.matches.slice(0, number)
|
||||
},
|
||||
LIVE_FOUND(state, { live }) {
|
||||
state.live.match = live
|
||||
state.live.liveLoaded = true
|
||||
|
|
@ -190,6 +194,9 @@ export const actions = {
|
|||
|
||||
commit('RECORDS_FOUND', { records })
|
||||
},
|
||||
sliceOverviewMatches({ commit }, number) {
|
||||
commit('KEEP_LAST_X_MATCHES', number)
|
||||
},
|
||||
updateSeason({ commit }, season) {
|
||||
commit('UPDATE_SEASON', { season })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,8 +99,12 @@ export default {
|
|||
if (!this.overviewLoaded && this.summonerFound) {
|
||||
this.overviewRequest()
|
||||
}
|
||||
// Keep only the 10 last matches when summoner enters overview page
|
||||
else if (this.overviewLoaded && this.summonerFound && this.overview.matches.length !== 10) {
|
||||
this.sliceOverviewMatches(10)
|
||||
}
|
||||
},
|
||||
...mapActions('summoner', ['moreMatches', 'overviewRequest']),
|
||||
...mapActions('summoner', ['moreMatches', 'overviewRequest', 'sliceOverviewMatches']),
|
||||
},
|
||||
|
||||
metaInfo() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue