mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
fix(more-matches): no longer display the load button unnecessarily
When the season filter is selected: check if there is more matches to load or not.
This commit is contained in:
parent
44f10b6c35
commit
67ff3380a0
1 changed files with 8 additions and 3 deletions
|
|
@ -178,8 +178,7 @@ export const actions = {
|
||||||
async moreMatches({ commit, getters, rootState }) {
|
async moreMatches({ commit, getters, rootState }) {
|
||||||
commit('MATCHES_LOADING')
|
commit('MATCHES_LOADING')
|
||||||
|
|
||||||
const gameIds = state.basic.matchList
|
const gameIds = getters.filteredMatchList
|
||||||
.filter(match => !getters.regionFilterApplied || match.seasonMatch === state.basic.currentSeason)
|
|
||||||
.slice(state.overview.matchIndex, state.overview.matchIndex + 10)
|
.slice(state.overview.matchIndex, state.overview.matchIndex + 10)
|
||||||
.map(({ gameId }) => gameId)
|
.map(({ gameId }) => gameId)
|
||||||
|
|
||||||
|
|
@ -230,8 +229,14 @@ export const actions = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getters = {
|
export const getters = {
|
||||||
|
filteredMatchList: (state, getters) => {
|
||||||
|
return state.basic.matchList
|
||||||
|
.filter(match => !getters.regionFilterApplied || match.seasonMatch === state.basic.currentSeason)
|
||||||
|
},
|
||||||
matchesLoading: state => state.overview.matchesLoading,
|
matchesLoading: state => state.overview.matchesLoading,
|
||||||
moreMatchesToFetch: state => state.overview.matchIndex < state.basic.matchList.length,
|
moreMatchesToFetch: (state, getters) => {
|
||||||
|
return state.overview.matchIndex < getters.filteredMatchList.length
|
||||||
|
},
|
||||||
overviewLoaded: state => state.overview.loaded,
|
overviewLoaded: state => state.overview.loaded,
|
||||||
playing: state => state.live.playing,
|
playing: state => state.live.playing,
|
||||||
regionFilterApplied: state => !!state.basic.currentSeason,
|
regionFilterApplied: state => !!state.basic.currentSeason,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue