Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,10 @@ class NoteEditor :
// changed did? this has to be done first as remFromDyn() involves a direct write to the database
if (currentEditedCard != null && currentEditedCard!!.currentDeckId() != deckId) {
reloadRequired = true
Copy link
Member

@david-allison david-allison Feb 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been tested:

  • In the Card Browser in Cards mode
  • From the Reviewer, editing a single card

From a brief overview of the code, this code would update all cards from the note, which is not expected.

undoableOp { setDeck(listOf(currentEditedCard!!.id), deckId) }
// Obtain all card IDs for the current note
val allCardIds = editorNote!!.cardIds(getColUnsafe)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val allCardIds = editorNote!!.cardIds(getColUnsafe)
val allCardIds = withCol { editorNote!!.cardIds(this) }

// Update the deck for every card of that note
undoableOp { setDeck(allCardIds, deckId) }
// refresh the card object to reflect the database changes from above
currentEditedCard!!.load(getColUnsafe)
// also reload the note object
Expand Down