-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
fix(tv show tabs): add sorting to vuex store to fix season ordering #480
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Codecov Report
@@ Coverage Diff @@
## master #480 +/- ##
==========================================
+ Coverage 11.76% 12.25% +0.49%
==========================================
Files 133 133
Lines 3451 3451
Branches 525 525
==========================================
+ Hits 406 423 +17
+ Misses 3024 3005 -19
- Partials 21 23 +2
Continue to review full report at Codecov.
|
Analyzing this a bit, this seems more like a logic issue in how the data is structured and assigned than a sorting issue. We're assigning episodes to an array, by combining the existing contents of the array with the new one. However, nothing guarantees that we are going to receive the seasons in the proper order or that said seasons would contain anything, or even return at all. I think the proper fix for this would be to rework the structure to be like so: const TvShowsState = {
'494947c860b2d2abaa645bffb9fde158': {
'seasons': {
0: {
'information': BaseItemDto // The season's info
'episodes': BaseItemDto[] // An array of all the episodes
}
}
}
} This way, we can set the info by key instead of by index, which allows us to go from 0 to 4 back to 2, as items come in. It also sets us up for adding more info to this store at a later date (Like storing the series' info directly in the store). Edit: though another, maybe more valid way to do this would be to split episodes and seasons into two stores, then use getters to fetch what we need and collate data in the components instead. |
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.
Should've probably marked my previous comment as a request for change, as the current way of doing things won't solve the core issue we're having.
Finally updated to use an object. Should be working now
|
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.
You can also simplify your Vue.set calls by just editing a sub-prop such as there:
jellyfin-vue/store/displayPreferences.ts
Line 96 in e70915b
Vue.set(state.CustomPrefs, key, defaultCustomPrefs[key]); |
The only issue is that |
Yeah that seems fair then |
@camc314 Also did you see the small comments I left? :) |
Yep, I'll address them in the next few hours 👍 |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Potentially fixes #479
After adding the array of episodes of each season. Sort by parentIndexNumber