-
Notifications
You must be signed in to change notification settings - Fork 887
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
Respect playlist sort order in watch-video-playlist
#5013
Respect playlist sort order in watch-video-playlist
#5013
Conversation
I don't see the need for this particular sort order.
Context from absidue: 'I don't think we should even attempt to support it, due to all of the situations where it wouldn't be possible.'
…at/add-playlist-sort-order
…at/add-playlist-sort-order-2
…at/add-playlist-sort-order-2
Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
66d67ff
to
1cf9f7e
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…at/add-playlist-sort-order-2
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…at/add-playlist-sort-order-2
Conflicts have been resolved. A maintainer will review the pull request shortly. |
I'm still feeling shaky about the energy expenditure aspect of it, so I'm leaning towards shelving it this release and working on the performance suggestions. |
Update 5/23:
|
I'm seeing merit to what you're saying, although:
This isn't exactly true, to be pedantic. If you have the sorting applied in
This is definitely the right choice if we're to go this path. Thanks for this suggestion. |
Update for those not privy to the private discussion: We will be addressing these performance concerns separately. Only additional requested change for this PR is that we send the cached playlist with sort order enabled whenever available to avoid an unnecessary re-sort whenever pulling up the cached user playlist. |
Pull request was converted to draft
Gonna wait till #5158 is merged first. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…at/add-playlist-sort-order-2
Conflicts have been resolved. A maintainer will review the pull request shortly. |
One other unrelated note (concerning future work) with doing sorting on the fly is that we won't be able to implement placing the proper playlist thumbnail corresponding to the video at the top of the sort order on the User Playlist page as easily. I don't think we've discussed that side of things before, but it is a minor thorn in the side I was hoping we could get around to. It shouldn't be an issue on the Playlist page at least, though, and we could carve out obvious O(1) exceptions for Earliest / Latest / Custom cases (even though it's not ideal to have that be inconsistent, those are the majority of sort types in use, I'd imagine). Maybe we could even make those non-3 sort options session-specific in their duration as a workaround for this, but that's probably a bit too far out of left field until we get more feedback on how users actually use them. It's perhaps me imposing my way of using FT, but I find it likely that people would want videos to be sorted alphabetically temporarily, but they would very rarely want it as a permanent thing. |
What do you mean with this? User is on the watch page and adds video to the playlist they are currently watching? |
Yes, sorry, I meant to say
As in, adding a video to the playlist while watching it, and ensuring it's placed in the proper place in the sort order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be working well
sortOrder === SORT_BY_VALUES.AuthorAscending || | ||
sortOrder === SORT_BY_VALUES.AuthorDescending | ||
) { | ||
collator = new Intl.Collator([locale, 'en']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Optional) I know nothing about Intl.Collator
But I would like to know if using a constant object be possible (map of locale
to Collator
objects lazily created)
(No idea how much it helps, if too complicated might not worth it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll mark it as a chore, although I'm skeptical if the access time would be considerably less than the creation time of this
* development: (60 commits) check for 204 error (FreeTubeApp#5259) Translated using Weblate (Turkish) ! Fix error when fetching deleted comment replies in local API (FreeTubeApp#5255) Optical enhancement - Improved spacing on the about page FreeTubeApp#5210 (FreeTubeApp#5257) Translated using Weblate (Czech) Translated using Weblate (Hungarian) Translated using Weblate (Estonian) Translated using Weblate (German) Update playlist page to add remove duplicate videos button for user playlists (FreeTubeApp#5191) Respect playlist sort order in `watch-video-playlist` (FreeTubeApp#5013) Translated using Weblate (Serbian) Translated using Weblate (Chinese (Simplified)) Translated using Weblate (Chinese (Traditional)) Translated using Weblate (Arabic) Translated using Weblate (Polish) Translated using Weblate (Italian) Translated using Weblate (Turkish) Translated using Weblate (Croatian) Translated using Weblate (Dutch) Translated using Weblate (Spanish) ...
Respect playlist sort order in watch-video-playlist
Pull Request Type
Related issue
#5008 (comment)
Description
Screenshots
Testing
watch-video-playlist
for arbitrary sortDesktop
Additional context
Note: Below performance concerns will be addressed in future PRs.
Playlist sort is computed when the user playlist in
watch-video-playlist
is first loaded and when it is updated with additions / removals during that session. While this is not necessarily having an apparent performance effect in my testing, I would imagine it's at least a potential concern w.r.t. sum power draw across our user base.As it stands, the O(nlogn) sorting operation is executed for each playlist load, or upon each addition/removal to a playlist while it is currently being watched. In the future, 1) we may want to consider adding an ordering property to playlistItems for the custom sort order instead of relying on its default order, 2) thus allowing the "sort" action to be one-and-done per sort preference change by storing that playlist in its sort preference, and 3) using binary search for each subsequent insertion into a playlist. This would remove the O(nlogn) operation upon each playlist load, and it would reduce the addition cost to O(klogn), where k is the number of elements being added.