diff --git a/packages/app/src/pages/home/components/livestreams/index.jsx b/packages/app/src/pages/home/components/livestreams/index.jsx index feda82e0..8721deb6 100644 --- a/packages/app/src/pages/home/components/livestreams/index.jsx +++ b/packages/app/src/pages/home/components/livestreams/index.jsx @@ -35,9 +35,12 @@ const LivestreamItem = (props) => { } export default (props) => { + const [loading, setLoading] = React.useState(true) const [list, setList] = React.useState([]) const loadStreamings = async () => { + setLoading(true) + const livestreams = await Livestream.getLivestreams().catch((err) => { console.error(err) app.message.error("Failed to load livestreams") @@ -46,6 +49,8 @@ export default (props) => { console.log("Livestreams", livestreams) + setLoading(false) + if (livestreams) { if (!Array.isArray(livestreams)) { console.error("Livestreams is not an array") @@ -65,6 +70,10 @@ export default (props) => { } const renderList = () => { + if (loading) { + return + } + if (list.length === 0) { return