From d3e7e3152f0707ba1b94b7c0e76ee8105eba3a47 Mon Sep 17 00:00:00 2001 From: TreetopFlyer Date: Tue, 26 Apr 2022 10:47:45 -0400 Subject: [PATCH] use objects in states instead of id strings --- app.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app.js b/app.js index 2380084..513166c 100644 --- a/app.js +++ b/app.js @@ -51,11 +51,11 @@ const App = props => /** @type {Boxcast.StateBinding>} */ const [ListGet, ListSet] = useState([]); - /** @type {Boxcast.StateBinding} */ - const [SelectedGet, SelectedSet] = useState(""); + /** @type {Boxcast.StateBinding} */ + const [SelectedGet, SelectedSet] = useState(null); - /** @type {Boxcast.StateBinding} */ - const [LiveGet, LiveSet] = useState(""); + /** @type {Boxcast.StateBinding} */ + const [LiveGet, LiveSet] = useState(null); /** @type {(inList:Array)=>Array} */ const SortStart = (inList) => { @@ -105,20 +105,20 @@ const App = props => // on new list useEffect(()=> { - let live = ""; + let live; for(let i=0; i { Player.current.loadChannel(props.channel, { - selectedBroadcastId: SelectedGet, + selectedBroadcastId: SelectedGet?.id, showTitle: true, showDescription: true, showCountdown: true, @@ -164,9 +164,9 @@ const App = props => { item: item, previous: ListGet[index-1], - priority: item.id == LiveGet, - selected: item.id == SelectedGet, - select: ()=>SelectedSet(item.id) + priority: item.id == LiveGet?.id, + selected: item.id == SelectedGet?.id, + select: ()=>SelectedSet(item) } )) }