Fixes selecting a profile leads to webui crash.

This commit is contained in:
SergeantPanda 2025-05-25 15:01:04 -05:00
parent 1ab04e31a4
commit 363a1a8080

View file

@ -118,9 +118,12 @@ export default function TVChannelGuide({ startDate, endDate }) {
if (selectedProfileId !== 'all') {
// Get the profile's enabled channels
const profileChannels = profiles[selectedProfileId]?.channels || [];
const enabledChannelIds = profileChannels
.filter((pc) => pc.enabled)
.map((pc) => pc.id);
// Check if channels is a Set (from the error message, it likely is)
const enabledChannelIds = Array.isArray(profileChannels)
? profileChannels.filter((pc) => pc.enabled).map((pc) => pc.id)
: profiles[selectedProfileId]?.channels instanceof Set
? Array.from(profiles[selectedProfileId].channels)
: [];
result = result.filter((channel) =>
enabledChannelIds.includes(channel.id)