Skip to content

Undo doesnt refresh the Card Browser's row list after deleting a note #21669

Description

@GuTS805

Checked for duplicates?

  • This issue is not a duplicate

Does it also happen in the desktop version?

  • This bug does not occur in the latest version of Anki Desktop

What are the steps to reproduce this bug?

  1. open the card browser
  2. select a note and delete it
  3. tap "undo" on the snackbar that pops up

Expected behaviour

the note should reappear in the browser list since its actually restored

Debug info

AnkiDroid Version = 2.24.0 (ebcf8e0e34921628b9b8a496c66ffd4adbb3705f)  
Backend Version = 0.1.64-anki25.09.2 (25.09.2 3890e12c9e48c028c3f12aa58cb64bd9f8895e30)  
Android Version = 13 (SDK 33)  
ProductFlavor = play  
Device Info = OnePlus | OnePlus | OP555BL1 | IV2201_IND | IV2201 | mt6877  
WebView Info = [com.google.android.webview | 787118103]: Mozilla/5.0 (Linux; Android 13; IV2201 Build/TP1A.220905.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/150.0.7871.181 Mobile Safari/537.36  
ACRA UUID = bbe8603c-4564-4f9f-9621-e2c7e5b9b556  
FSRS = 5.1.0 (Enabled: false)  
Crash Reports Enabled = true

(Optional) Anything else you want to share?

dug into this a bit. CardBrowserViewModel.deleteSelectedNotes() calls refreshSearch() itself after deleting, but undo doesnt go through that path at all. tryUndo() in Undo.kt just calls undoableOp { undo() } with no handler, and the only thing listening (CardBrowserFragment.opExecuted) just calls notifyDataSetChanged() which re-renders the same stale list instead of re-searching.

so the note does actually come back in the collection, col.cardCount() proves it, but the browser just never re-queries to show it. wrote a test confirming this fails on main right now. already have a fix idea (make the viewmodel subscribe to changes and refresh, or have opExecuted call refreshSearch instead of just notifyDataSetChanged), will open a PR

Research

  • I have checked the manual and the FAQ and could not find a solution to my issue
  • (Optional) I have confirmed the issue is not resolved in the latest alpha release (instructions)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions