Fix empty search results bug

This commit is contained in:
Brahim Hadriche committed 2024-02-27 20:45:32 -05:00
1 parent aebdc579a9
commit 8e03ca0ea6
5 files changed
+31 -6

No files matched your search

@@ -218,7 +218,6 @@ end function
function InitContent() as void
CancelCurrentTasks()
m.top.someContentReady = false
if m.top.feeds = invalid
m.top.content = invalid
@@ -6,7 +6,13 @@
<field id="bookmarks" type="node" bind="/Bookmarks" />
<field id="screen" type="node" />
<field id="feeds" type="array" onChange="OnFeedsChange" />
<field id="someContentReady" type="bool" />
<!--
someContentReady is a field specifically for the search screen.
It is set to true when there are some search results
and set to false when there are no search results.
It a signal to make sure to hide the loading indicator.
-->
<field id="someContentReady" type="bool" alwaysNotify="true" />
<field id="onError" type="string" alwaysNotify="true" />
<function name="OpenPlaylist" />
<function name="OpenChannel" />
@@ -14,6 +14,8 @@ function VideoRowListRowContentTask(input as object) as object
totalfetchedItems = 0
someContentReadySet = false
while true
if m.top.cancel
feedContentNode.loadState = FeedLoadState.None
@@ -25,6 +27,10 @@ function VideoRowListRowContentTask(input as object) as object
if feedSourcesIndex >= feedSources.Count()
feedContentNode.loadState = FeedLoadState.Loaded
if not someContentReadySet
rowList.someContentReady = false
end if
return {
success: true
}
@@ -36,6 +42,9 @@ function VideoRowListRowContentTask(input as object) as object
feedSourcesIndex += 1
if feedSourcesIndex >= feedSources.Count()
feedContentNode.loadState = FeedLoadState.Loaded
if not someContentReadySet
rowList.someContentReady = false
end if
return {
success: true
}
@@ -130,7 +139,8 @@ function VideoRowListRowContentTask(input as object) as object
feedContentNode.loadState = FeedLoadState.LoadedPage
end if
if itemNodes.Count() > 0
if itemNodes.Count() > 0 and not someContentReadySet
someContentReadySet = true
rowList.someContentReady = true
end if