Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix outdated subscription cache clearing code when "Remove All Subscriptions / Profiles" performed #3817

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/renderer/components/privacy-settings/privacy-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,24 @@ export default defineComponent({

this.updateActiveProfile(MAIN_PROFILE_ID)

if (option === 'yes') {
this.profileList.forEach((profile) => {
if (profile._id === MAIN_PROFILE_ID) {
const newProfile = {
_id: MAIN_PROFILE_ID,
name: profile.name,
bgColor: profile.bgColor,
textColor: profile.textColor,
subscriptions: []
}
this.updateProfile(newProfile)
} else {
this.removeProfile(profile._id)
if (option !== 'yes') { return }

this.profileList.forEach((profile) => {
if (profile._id === MAIN_PROFILE_ID) {
const newProfile = {
_id: MAIN_PROFILE_ID,
name: profile.name,
bgColor: profile.bgColor,
textColor: profile.textColor,
subscriptions: []
}
})
this.updateProfile(newProfile)
} else {
this.removeProfile(profile._id)
}
})

this.clearSubscriptionsCache()
}
this.clearSubscriptionsCache()
},

...mapActions([
Expand Down
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