Checked for duplicates?
Does it also happen in the desktop version?
What are the steps to reproduce this bug?
- open the card browser
- select a note and delete it
- 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
Checked for duplicates?
Does it also happen in the desktop version?
What are the steps to reproduce this bug?
Expected behaviour
the note should reappear in the browser list since its actually restored
Debug info
(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