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

Various minor performance improvements to the subscription page #5722

Merged
merged 1 commit into from
Sep 23, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineComponent({
},
data: function () {
return {
isLoading: false,
isLoading: true,
postList: [],
errorChannels: [],
attemptedFetch: false,
Expand Down Expand Up @@ -101,8 +101,6 @@ export default defineComponent({
},
},
mounted: async function () {
this.isLoading = true

this.loadPostsFromCacheSometimes()
},
methods: {
Expand All @@ -120,11 +118,8 @@ export default defineComponent({
},

async loadPostsFromCacheForAllActiveProfileChannels() {
const postList = []
this.activeSubscriptionList.forEach((channel) => {
const channelCacheEntry = this.$store.getters.getPostsCacheByChannel(channel.id)

postList.push(...channelCacheEntry.posts)
const postList = this.cacheEntriesForAllActiveProfileChannels.flatMap((cacheEntry) => {
return cacheEntry.posts
})

postList.sort((a, b) => {
Expand All @@ -143,7 +138,6 @@ export default defineComponent({
}

const channelsToLoadFromRemote = this.activeSubscriptionList
const postList = []
let channelCount = 0
this.isLoading = true

Expand Down Expand Up @@ -193,13 +187,13 @@ export default defineComponent({
}

return posts
}))).flatMap((o) => o)
postList.push(...postListFromRemote)
postList.sort((a, b) => {
}))).flat()

postListFromRemote.sort((a, b) => {
return b.publishedTime - a.publishedTime
})

this.postList = postList
this.postList = postListFromRemote
this.isLoading = false
this.updateShowProgressBar(false)
this.lastRemoteRefreshSuccessTimestamp = new Date()
Expand Down
18 changes: 6 additions & 12 deletions src/renderer/components/subscriptions-live/subscriptions-live.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineComponent({
},
data: function () {
return {
isLoading: false,
isLoading: true,
videoList: [],
errorChannels: [],
attemptedFetch: false,
Expand Down Expand Up @@ -111,8 +111,6 @@ export default defineComponent({
},
},
mounted: async function () {
this.isLoading = true

this.loadVideosFromCacheSometimes()
},
methods: {
Expand All @@ -130,12 +128,10 @@ export default defineComponent({
},

async loadVideosFromCacheForAllActiveProfileChannels() {
const videoList = []
this.activeSubscriptionList.forEach((channel) => {
const channelCacheEntry = this.$store.getters.getLiveCacheByChannel(channel.id)

videoList.push(...channelCacheEntry.videos)
const videoList = this.cacheEntriesForAllActiveProfileChannels.flatMap((cacheEntry) => {
return cacheEntry.videos
})

this.videoList = updateVideoListAfterProcessing(videoList)
this.isLoading = false
},
Expand All @@ -148,7 +144,6 @@ export default defineComponent({
}

const channelsToLoadFromRemote = this.activeSubscriptionList
const videoList = []
let channelCount = 0
this.isLoading = true

Expand Down Expand Up @@ -202,10 +197,9 @@ export default defineComponent({
}

return videos
}))).flatMap((o) => o)
videoList.push(...videoListFromRemote)
}))).flat()

this.videoList = updateVideoListAfterProcessing(videoList)
this.videoList = updateVideoListAfterProcessing(videoListFromRemote)
this.isLoading = false
this.updateShowProgressBar(false)
this.lastRemoteRefreshSuccessTimestamp = new Date()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default defineComponent({
},
data: function () {
return {
isLoading: false,
isLoading: true,
videoList: [],
errorChannels: [],
attemptedFetch: false,
Expand Down Expand Up @@ -105,8 +105,6 @@ export default defineComponent({
},
},
mounted: async function () {
this.isLoading = true

this.loadVideosFromCacheSometimes()
},
methods: {
Expand All @@ -124,12 +122,10 @@ export default defineComponent({
},

async loadVideosFromCacheForAllActiveProfileChannels() {
const videoList = []
this.activeSubscriptionList.forEach((channel) => {
const channelCacheEntry = this.$store.getters.getShortsCacheByChannel(channel.id)

videoList.push(...channelCacheEntry.videos)
const videoList = this.cacheEntriesForAllActiveProfileChannels.flatMap((cacheEntry) => {
return cacheEntry.videos
})

this.videoList = updateVideoListAfterProcessing(videoList)
this.isLoading = false
},
Expand All @@ -142,7 +138,6 @@ export default defineComponent({
}

const channelsToLoadFromRemote = this.activeSubscriptionList
const videoList = []
let channelCount = 0
this.isLoading = true
this.updateShowProgressBar(true)
Expand Down Expand Up @@ -178,10 +173,9 @@ export default defineComponent({
}

return videos
}))).flatMap((o) => o)
videoList.push(...videoListFromRemote)
}))).flat()

this.videoList = updateVideoListAfterProcessing(videoList)
this.videoList = updateVideoListAfterProcessing(videoListFromRemote)
this.isLoading = false
this.updateShowProgressBar(false)
this.lastRemoteRefreshSuccessTimestamp = new Date()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineComponent({
},
data: function () {
return {
isLoading: false,
isLoading: true,
videoList: [],
errorChannels: [],
attemptedFetch: false,
Expand Down Expand Up @@ -115,8 +115,6 @@ export default defineComponent({
},
},
mounted: async function () {
this.isLoading = true

this.loadVideosFromCacheSometimes()
},
methods: {
Expand All @@ -134,12 +132,10 @@ export default defineComponent({
},

async loadVideosFromCacheForAllActiveProfileChannels() {
const videoList = []
this.activeSubscriptionList.forEach((channel) => {
const channelCacheEntry = this.$store.getters.getVideoCacheByChannel(channel.id)

videoList.push(...channelCacheEntry.videos)
const videoList = this.cacheEntriesForAllActiveProfileChannels.flatMap((cacheEntry) => {
return cacheEntry.videos
})

this.videoList = updateVideoListAfterProcessing(videoList)
this.isLoading = false
},
Expand All @@ -152,7 +148,6 @@ export default defineComponent({
}

const channelsToLoadFromRemote = this.activeSubscriptionList
const videoList = []
let channelCount = 0
this.isLoading = true

Expand Down Expand Up @@ -206,10 +201,9 @@ export default defineComponent({
}

return videos
}))).flatMap((o) => o)
videoList.push(...videoListFromRemote)
}))).flat()

this.videoList = updateVideoListAfterProcessing(videoList)
this.videoList = updateVideoListAfterProcessing(videoListFromRemote)
this.isLoading = false
this.updateShowProgressBar(false)
this.lastRemoteRefreshSuccessTimestamp = new Date()
Expand Down