Fix: removed video from playlist is still associated with the playlist in history#9290
Fix: removed video from playlist is still associated with the playlist in history#9290Shadorc wants to merge 8 commits into
Conversation
Pull request was converted to draft
|
I was thinking about maybe reducing store dispatch calls by pre-checking the playlist instead of checking it in
Result: The bug still occurs. This is why I let the database query make the final decision, even though it's a bit less optimized regarding IPC calls |
Pull request was converted to draft
|
Interesting, thanks for testing! |
efb4f5ff-1298-471a-8973-3d47447115dc
left a comment
There was a problem hiding this comment.
1,1b and 2 pass
1c doesnt see clip below
VirtualBoxVM_QoOXPrYMCq.mp4
Pull request was converted to draft
|
Thanks for finding this! Indeed, removing a video from a playlist can be done from multiple entry points, and the bookmark icon is one of them. Instead of trying to find every path that leads to a video being removed from a playlist, I think it would be better to directly plug the fix at the lowest level, which is in the playlist store. Another solution that comes to my mind would be to have another method that handles both calls to the history and playlist stores, and this would be called instead of directly calling the playlist store. I can also still search for all paths that lead to videos being removed from playlists, but that doesn't feel future-proof. What do you think? |
|
Dispatching action calls between stores is fine, the most important thing is to make sure you don't end up creating a loop (store 1 calling into store 2 and store 2 calling into store 1 in response etc). |
|
I have added scenario 1c to the testing section. It has been fixed in a3b5541 (sorry for the yarn.lock, it shouldn't happen again). To be consistent with the fix, I have also taken into account all the other methods that could impact a playlist or a video in a playlist (a478bda). It is not strictly necessary because if a playlist is deleted from However, I feel like having an outdated database is worse than adding additional database operations that are not strictly useful. It is handled currently, but it could lead to bugs in the future.
|
Pull Request Type
Related issue
closes #5870
Description
This one was a lot of digging.
When a video is added to the history db, there are three fields that are set to indicate if it was part of a playlist when watched. These fields are
lastViewedPlaylistId,lastViewedPlaylistTypeandlastViewedPlaylistItemId, they are used to display the playlist view after clicking on the video from the history.When a video is deleted from a playlist, these fields are not updated.
Testing
Scenario 1: the video is part of only one playlist
Reproduce steps in #5870
Scenario 1bis: the video is part of only one playlist
Reproduce previous steps but change tab within 5 seconds after removing the video from the playlist.
Scenario 2: the video is part of more than one playlist
Scenario 3: the video was added in a playlist through the quick bookmark button
Additional context
Naming was hard on this one. I take every suggestions that could make this clearer.
Also, I could have used array
toBeDeletedPlaylistItemIdsto populate withvideosIdandplaylistIdbut I didn't want to introduce any breaking changes regarding this array so I went with another one.