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

Conversation

absidue
Copy link
Member

@absidue absidue commented Sep 21, 2024

Various minor performance improvements to the subscription page

Pull Request Type

  • Performance improvements

Description

This pull request adds a few minor performance improvements to the subscriptions page. I've been using these in my own build for a few weeks now and haven't noticed any problems with them. The changes in this pull request can be grouped into 4 groups and are the same across all 4 subscription tabs.

  1. Initialise isLoading with true instead of setting it to true in the mounted hook. This avoids Vue rendering an empty subscription tab, then a loading one and then again with the content, as it now only has to render the loading one and then the one with the content.
  2. Switch from using Array#flatMap() with a passthrough function to just using Array#flat() directly.
  3. As we fetch the channel cache entries from the cache in the cacheEntriesForAllActiveProfileChannels computed property, we can just use the entries from that, instead of loading them from the cache again in loadVideosFromCacheForAllActiveProfileChannels().
  4. At the moment we create an empty array, then push all of the fetched data into that array in one big call to Array#push, I decided that it would make more sense to just use the array with the fetched data directly, instead of copying it into an empty array first.

Testing

Check that refreshing your subscriptions and loading them from the cache both still work correctly.

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: 9ca2c74

@absidue absidue added the PR: low priority For pull requests that don't require a fast review. e.g. code cleanup label Sep 21, 2024
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) September 21, 2024 16:23
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Sep 21, 2024
@FreeTubeBot FreeTubeBot merged commit b1861ff into FreeTubeApp:development Sep 23, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Sep 23, 2024
@absidue absidue deleted the subscriptions-perf branch September 23, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: low priority For pull requests that don't require a fast review. e.g. code cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants