From 59ed47108df6bd66d35f991fba0c32e9be43c525 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Wed, 8 Nov 2023 13:43:21 -0500 Subject: [PATCH] Fix/error dialog on disposed rowlist (#196) * Dispose tasks when disposing a view * Do not show dialog on disposed views --- CHANGELOG.md | 1 + playlet-lib/src/components/VideoFeed/VideoRowList.bs | 2 +- .../src/components/VideoFeed/VideoRowListRowContentTask.bs | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c3e24ac..5a5056e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - 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 ## [0.15.0] - 2023-11-05 diff --git a/playlet-lib/src/components/VideoFeed/VideoRowList.bs b/playlet-lib/src/components/VideoFeed/VideoRowList.bs index f64f8ebf..a04e6cbf 100644 --- a/playlet-lib/src/components/VideoFeed/VideoRowList.bs +++ b/playlet-lib/src/components/VideoFeed/VideoRowList.bs @@ -1,6 +1,5 @@ import "pkg:/components/ChannelView/ChannelUtils.bs" import "pkg:/components/ContextMenu/ContextMenuUtils.bs" -import "pkg:/components/Dialog/DialogUtils.bs" import "pkg:/components/Navigation/LongPress.bs" import "pkg:/components/PlaylistView/PlaylistUtils.bs" import "pkg:/components/VideoFeed/VideoRowListContentTask.bs" @@ -315,5 +314,6 @@ function OnkeyEvent(key as string, press as boolean) as boolean end function function OnDispose() + CancelCurrentTasks() DisposeObservers() end function diff --git a/playlet-lib/src/components/VideoFeed/VideoRowListRowContentTask.bs b/playlet-lib/src/components/VideoFeed/VideoRowListRowContentTask.bs index 5bceb720..3b8fdc03 100644 --- a/playlet-lib/src/components/VideoFeed/VideoRowListRowContentTask.bs +++ b/playlet-lib/src/components/VideoFeed/VideoRowListRowContentTask.bs @@ -165,9 +165,12 @@ function RemovePlaceHolderItems(contentNode as object) end while end function -function HandleFeedLoadErrorDialog(error as object, rowList as object) +function HandleFeedLoadErrorDialog(error as object, rowList as object) as void error = ErrorUtils.Format(error) LogError(error) rowList.onError = error + if rowList.hasField("dispose") and rowList.dispose + return + end if DialogUtils.ShowDialog(error, "Failed to load feed", true) end function