fix: filter hub detail view by library section

close #638
This commit is contained in:
edde746
2026-03-06 18:36:45 +01:00
parent 7825490b0f
commit b05d69b10f
3 changed files with 13 additions and 1 deletions
+5
View File
@@ -15,6 +15,10 @@ class PlexHub {
final String? serverId; // Server machine identifier
final String? serverName; // Server display name
/// When set, this hub was split from a multi-library hub and should only
/// show items belonging to this library section.
final int? librarySectionID;
PlexHub({
required this.hubKey,
required this.title,
@@ -25,6 +29,7 @@ class PlexHub {
required this.items,
this.serverId,
this.serverName,
this.librarySectionID,
});
factory PlexHub.fromJson(Map<String, dynamic> json) {
+7 -1
View File
@@ -240,7 +240,13 @@ class _HubDetailScreenState extends State<HubDetailScreen>
final client = _getClientForHub();
// Fetch items from the hub, tagged with server info at the source
final items = await client.getHubContent(widget.hub.hubKey);
var items = await client.getHubContent(widget.hub.hubKey);
// Filter to specific library if this hub was split from a multi-library hub
final sectionFilter = widget.hub.librarySectionID;
if (sectionFilter != null) {
items = items.where((item) => item.librarySectionID == sectionFilter).toList();
}
if (!mounted) return;
setState(() {
@@ -350,6 +350,7 @@ class DataAggregationService {
items: items,
serverId: hub.serverId,
serverName: hub.serverName,
librarySectionID: entry.key,
));
}