diff --git a/CHANGELOG.md b/CHANGELOG.md index f9594ca1..3c3e24ac 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 bookmarks show duplicate videos ## [0.15.0] - 2023-11-05 diff --git a/playlet-web/src/lib/VideoFeed/VideoListRow.svelte b/playlet-web/src/lib/VideoFeed/VideoListRow.svelte index d0e380b8..bb7fdc33 100644 --- a/playlet-web/src/lib/VideoFeed/VideoListRow.svelte +++ b/playlet-web/src/lib/VideoFeed/VideoListRow.svelte @@ -99,8 +99,23 @@ return; } - feedLoadState = FeedLoadState.Loading; + if (loadDataTask) { + return; + } + try { + loadDataTask = loadData(); + await loadDataTask; + } catch (error) { + console.error(error); + } + loadDataTask = undefined; + } + + let loadDataTask; + + async function loadData() { + feedLoadState = FeedLoadState.Loading; let totalFetchedItems = 0; while (true) { @@ -152,7 +167,7 @@ if ( feedSource.state.loadState === FeedLoadState.Loaded && - feedSourcesIndex === feedSources.length - 1 + feedSourcesIndex >= feedSources.length - 1 ) { feedLoadState = FeedLoadState.Loaded; } else {