Skip to content

Commit

Permalink
fix: Processing... popup in app startup
Browse files Browse the repository at this point in the history
8e0b537 introduced a call to
`updateMenuState()` at the loadDeckCounts job in order to update the
undo label state when the deck is reloaded.

Following the method name, the whole menu is updated instead of only the
undo label, which includes checking if there are changes to sync
remotely, and that takes time, so it shouldn't be done if not necessary.

The fix isn't the ideal one, but the menu of the deck picker is a zone,
so I'll leave it as is.
  • Loading branch information
BrayanDSO committed Jul 19, 2024
1 parent bc26f7f commit 2d1a4f1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,15 @@ open class DeckPicker :
}
}

private suspend fun updateUndoMenuState() {
withOpenColOrNull {
optionsMenuState = optionsMenuState?.copy(
undoLabel = undoLabel(),
undoAvailable = undoAvailable()
)
}
}

private fun updateSearchVisibilityFromState(menu: Menu) {
optionsMenuState?.run {
menu.findItem(R.id.deck_picker_action_filter).isVisible = searchIcon
Expand Down Expand Up @@ -2132,7 +2141,7 @@ open class DeckPicker :
}
onDecksLoaded(deckDueTree, collectionHasNoCards)

updateMenuState()
updateUndoMenuState()
}
}
}
Expand Down

0 comments on commit 2d1a4f1

Please sign in to comment.