[tvOS] Episode/Season Focus gets Stuck (#1185)
* Focus on the first element if the lastFocusedEpisodeId isn't in the viewModel. * Performance Improvements: - Optimized Lookup: Used a Set for efficient checking of whether lastFocusedEpisodeID exists in viewModel.elements. - Single Pass: Reduced the number of passes needed to check for existence and set the focusedEpisodeID. * https://github.com/jellyfin/Swiftfin/pull/1185#pullrequestreview-2241625398 Suggestions --------- Co-authored-by: Joseph Kribs <joseph@kribs.net>
This commit is contained in:
parent
dcb3483e8d
commit
11c25648bf
|
@ -85,6 +85,11 @@ extension SeriesEpisodeSelector {
|
||||||
guard let newValue else { return }
|
guard let newValue else { return }
|
||||||
lastFocusedEpisodeID = newValue
|
lastFocusedEpisodeID = newValue
|
||||||
}
|
}
|
||||||
|
.onChange(of: viewModel.state) { _, newValue in
|
||||||
|
if newValue == .content {
|
||||||
|
lastFocusedEpisodeID = viewModel.elements.first?.id
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue