Skip to content

Commit

Permalink
Fix refresh of DeckPicker UI after a new collection import
Browse files Browse the repository at this point in the history
The fix introduces a call to withCol {} to make sure the collection is
open and available before any of the code that updates the UI in
DeckPicker runs.
  • Loading branch information
lukstbit authored and mikehardy committed May 2, 2024
1 parent 8e29b5a commit 4bd2cd1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2635,9 +2635,14 @@ open class DeckPicker :
}

override fun onImportColpkg(colpkgPath: String?) {
invalidateOptionsMenu()
updateDeckList()
importColpkgListener?.onImportColpkg(colpkgPath)
launchCatchingTask {
// as the current collection is closed before importing a new collection, make sure the
// new collection is open before the code to update the DeckPicker ui runs
withCol { }
invalidateOptionsMenu()
updateDeckList()
importColpkgListener?.onImportColpkg(colpkgPath)
}
}

override fun onMediaSyncCompleted(data: SyncCompletion) {
Expand Down

0 comments on commit 4bd2cd1

Please sign in to comment.