From b05d69b10fbf0b0db14a811152476393e83d647b Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Fri, 6 Mar 2026 18:36:29 +0100 Subject: [PATCH] fix: filter hub detail view by library section close #638 --- lib/models/plex_hub.dart | 5 +++++ lib/screens/hub_detail_screen.dart | 8 +++++++- lib/services/data_aggregation_service.dart | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/models/plex_hub.dart b/lib/models/plex_hub.dart index 89eb6520..51471904 100644 --- a/lib/models/plex_hub.dart +++ b/lib/models/plex_hub.dart @@ -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 json) { diff --git a/lib/screens/hub_detail_screen.dart b/lib/screens/hub_detail_screen.dart index d8d20ce9..cd259f1c 100644 --- a/lib/screens/hub_detail_screen.dart +++ b/lib/screens/hub_detail_screen.dart @@ -240,7 +240,13 @@ class _HubDetailScreenState extends State 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(() { diff --git a/lib/services/data_aggregation_service.dart b/lib/services/data_aggregation_service.dart index 26278d25..bca00a23 100644 --- a/lib/services/data_aggregation_service.dart +++ b/lib/services/data_aggregation_service.dart @@ -350,6 +350,7 @@ class DataAggregationService { items: items, serverId: hub.serverId, serverName: hub.serverName, + librarySectionID: entry.key, )); }