Cache quick bookmark playlist to reduce the amount of lookups #5169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cache quick bookmark playlist to reduce the amount of lookups
Pull Request Type
Description
The quick bookmark playlist is accessed in many places in the app, most notably inside every
ft-list-video
instance to check if said video is in the quick bookmark playlist. Every place that needs the quick bookmark playlist currently searches for the playlist by itself, not just when it's created but any time that any playlist is updated or the quick bookmark target is updated. This pull request moves that search into a getter inside the playlist store. Getters inside the vuex store cache their result (not if you return a function though) and are lazily evaluated, just like computed properties inside a component. That means that the search only needs to be done once, per triggering change, instead of many times.I'm not expecting this improvement to be drastic enough to be noticeable without measuring tools, but it's still worth it as we are doing less work.
Testing
Add videos to and remove videos from the quick bookmark playlist, while checking that the icon still updates accordingly.
Desktop