Fix/error dialog on disposed rowlist (#196)

* Dispose tasks when disposing a view

* Do not show dialog on disposed views
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2023-11-08 13:43:21 -05:00
1 parent 2eb0cf88af
commit 59ed47108d
3 files changed
+6 -2

No files matched your search

+1
View File
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- A rare bug that causes the app to crash when displaying video cells - A rare bug that causes the app to crash when displaying video cells
- A bug where we show error dialogs that happened on screens that are already closed
- A bug where bookmarks show duplicate videos - A bug where bookmarks show duplicate videos
## [0.15.0] - 2023-11-05 ## [0.15.0] - 2023-11-05
@@ -1,6 +1,5 @@
import "pkg:/components/ChannelView/ChannelUtils.bs" import "pkg:/components/ChannelView/ChannelUtils.bs"
import "pkg:/components/ContextMenu/ContextMenuUtils.bs" import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Navigation/LongPress.bs" import "pkg:/components/Navigation/LongPress.bs"
import "pkg:/components/PlaylistView/PlaylistUtils.bs" import "pkg:/components/PlaylistView/PlaylistUtils.bs"
import "pkg:/components/VideoFeed/VideoRowListContentTask.bs" import "pkg:/components/VideoFeed/VideoRowListContentTask.bs"
@@ -315,5 +314,6 @@ function OnkeyEvent(key as string, press as boolean) as boolean
end function end function
function OnDispose() function OnDispose()
CancelCurrentTasks()
DisposeObservers() DisposeObservers()
end function end function
@@ -165,9 +165,12 @@ function RemovePlaceHolderItems(contentNode as object)
end while end while
end function end function
function HandleFeedLoadErrorDialog(error as object, rowList as object) function HandleFeedLoadErrorDialog(error as object, rowList as object) as void
error = ErrorUtils.Format(error) error = ErrorUtils.Format(error)
LogError(error) LogError(error)
rowList.onError = error rowList.onError = error
if rowList.hasField("dispose") and rowList.dispose
return
end if
DialogUtils.ShowDialog(error, "Failed to load feed", true) DialogUtils.ShowDialog(error, "Failed to load feed", true)
end function end function