From 67ff3380a07b497e64a33ae27b4bd502a685b5c2 Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Sat, 14 Nov 2020 18:40:26 +0100 Subject: [PATCH] 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. --- client/src/store/modules/summoner.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/src/store/modules/summoner.js b/client/src/store/modules/summoner.js index d35a39f..2b59d45 100644 --- a/client/src/store/modules/summoner.js +++ b/client/src/store/modules/summoner.js @@ -178,8 +178,7 @@ export const actions = { async moreMatches({ commit, getters, rootState }) { commit('MATCHES_LOADING') - const gameIds = state.basic.matchList - .filter(match => !getters.regionFilterApplied || match.seasonMatch === state.basic.currentSeason) + const gameIds = getters.filteredMatchList .slice(state.overview.matchIndex, state.overview.matchIndex + 10) .map(({ gameId }) => gameId) @@ -230,8 +229,14 @@ export const actions = { } export const getters = { + filteredMatchList: (state, getters) => { + return state.basic.matchList + .filter(match => !getters.regionFilterApplied || match.seasonMatch === state.basic.currentSeason) + }, 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, playing: state => state.live.playing, regionFilterApplied: state => !!state.basic.currentSeason,