ankidroid / ankidroid/Anki-Android

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

Đang mở
#21,669 8 bình luận 0 reaction 1 người được giao Được @GuTS805 nhận Xem trên GitHub
Needs Triage
Ngôn ngữ chính
Kotlin
Star
11.8k
Fork
2.9k
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
171

Mô tả

### Checked for duplicates?

- [x] This issue is not a duplicate

### Does it also happen in the desktop version?

- [x] 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

```text
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

- [x] I have checked the [manual](https://docs.ankidroid.org/) and the [FAQ](https://github.com/ankidroid/Anki-Android/wiki/FAQ) and could not find a solution to my issue
- [x] (Optional) I have confirmed the issue is not resolved in the latest alpha release ([instructions](https://docs.ankidroid.org/manual.html#betaTesting))

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.