Skip to content

Commit

Permalink
* Use one action to clear cache instead of three
Browse files Browse the repository at this point in the history
  • Loading branch information
PikachuEXE committed Jul 27, 2023
1 parent 32c3f5d commit 7629c36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
8 changes: 2 additions & 6 deletions src/renderer/components/privacy-settings/privacy-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ export default defineComponent({
}
})

this.clearSubscriptionVideosCache()
this.clearSubscriptionShortsCache()
this.clearSubscriptionLiveCache()
this.clearSubscriptionsCache()
}
},

Expand All @@ -126,9 +124,7 @@ export default defineComponent({
'updateProfile',
'removeProfile',
'updateActiveProfile',
'clearSubscriptionVideosCache',
'clearSubscriptionShortsCache',
'clearSubscriptionLiveCache',
'clearSubscriptionsCache',
])
}
})
24 changes: 9 additions & 15 deletions src/renderer/store/modules/subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,27 @@ const getters = {

getLiveCacheByChannel: (state) => (channelId) => {
return state.liveCache[channelId]
}
},
}

const actions = {
clearSubscriptionVideosCache: ({ commit }) => {
commit('clearVideoCache')
},

updateSubscriptionVideosCacheByChannel: ({ commit }, payload) => {
commit('updateVideoCacheByChannel', payload)
},

clearSubscriptionShortsCache: ({ commit }) => {
commit('clearShortsCache')
},

updateSubscriptionShortsCacheByChannel: ({ commit }, payload) => {
commit('updateShortsCacheByChannel', payload)
},

clearSubscriptionLiveCache: ({ commit }) => {
commit('clearLiveCache')
},

updateSubscriptionLiveCacheByChannel: ({ commit }, payload) => {
commit('updateLiveCacheByChannel', payload)
}
},

clearSubscriptionsCache: ({ commit }, payload) => {
commit('clearVideoCache', payload)
commit('clearShortsCache', payload)
commit('clearLiveCache', payload)
},
}

const mutations = {
Expand Down Expand Up @@ -91,7 +85,7 @@ const mutations = {
},
clearLiveCache(state) {
state.liveCache = {}
}
},
}

export default {
Expand Down

0 comments on commit 7629c36

Please sign in to comment.