Rotating the browser clears filters chosen in the search screen
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
Research direction
Start with the new test recreating keeps the chosen filters in AnkiDroid/src/test/java/com/ichi2/anki/browser/CardBrowserSearchErrorTest.kt, which uses openSearch, searchViewModel.setFlagsFilter and filtersFlow. Read how the search filters are held in the browser's ViewModel and what happens to them when the activity is recreated. Done when this test passes and the other tests in that file still pass.
Written by the indexing model from the issue text.
Description
Assisted-by: Claude Opus 5.5 max
[EXISTING] Rotating the browser clears filters chosen in the search screen
Subject: [EXISTING] Rotating the browser clears filters chosen in the search screen
Choosing a filter such as a flag in the open search screen, then rotating, resets the filter before the search is submitted.
⚠️ This issue existed before the PR and should likely be split off into a separate issue.
---
diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/browser/CardBrowserSearchErrorTest.kt b/AnkiDroid/src/test/java/com/ichi2/anki/browser/CardBrowserSearchErrorTest.kt
index 4e1608764f..07db2361df 100644
--- a/AnkiDroid/src/test/java/com/ichi2/anki/browser/CardBrowserSearchErrorTest.kt
+++ b/AnkiDroid/src/test/java/com/ichi2/anki/browser/CardBrowserSearchErrorTest.kt
@@ -10,6 +10,7 @@ import androidx.test.core.app.ActivityScenario
import com.ichi2.anki.BottomNavController.NavigationItem
import com.ichi2.anki.CardBrowser
import com.ichi2.anki.DeckPicker
+import com.ichi2.anki.Flag
import com.ichi2.anki.RobolectricTest
import com.ichi2.anki.browser.search.SearchRequest
import com.ichi2.anki.ioDispatcher
@@ -94,6 +95,18 @@ class CardBrowserSearchErrorTest : RobolectricTest() {
assertSame(rejectedSearch, activityViewModel.searchJob)
}
+ @Test
+ fun `recreating keeps the chosen filters`() =
+ withSuccessfulSearch { recreate ->
+ openSearch("cat")
+ searchViewModel.setFlagsFilter(listOf(Flag.RED))
+
+ val restored = recreate()
+ restored.awaitSearch()
+
+ assertEquals(listOf(Flag.RED), restored.searchViewModel.filtersFlow.value.flags)
+ }
+
@Test
fun `recreating the browser does not rerun a rejected search`() =
withSuccessfulSearch { recreate ->
Found while reviewing https://github.com/ankidroid/Anki-Android/pull/23344
- Dominant language
- Kotlin
- Stars
- 12.3k
- Forks
- 3.1k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 311
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ankidroid/Anki-Android
-
code-scan
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ankidroid/Anki-Android#23806 ·
Maintainers usually reply within 1 day
-
code-scan
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
ankidroid/Anki-Android#23798 ·
Maintainers usually reply within 1 day
-
Send troubleshooting report does nothing with Never but says it was sentPossibly taken @rishithareddychalla claimed this today. Opencode-scan
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ankidroid/Anki-Android#23797 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Browse rows that fail to load show as empty linesPossibly taken @rishithareddychalla claimed this today. Opencode-scan
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ankidroid/Anki-Android#23786 · 1 comment ·
Maintainers usually reply within 1 day
-
The note editor's Cards button shows card type names as HTMLPossibly taken @rishithareddychalla claimed this today. Opencode-scan
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
ankidroid/Anki-Android#23756 · 1 comment ·
Maintainers usually reply within 1 day
All issues in ankidroid/Anki-Android
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Remove Collect againOpen
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
thisisartman/Meguri#211 ·
Maintainers usually reply within 1 day
-
follow-up
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Bug: Paused screen is never cleared, so spans and logs keep the previous fragment's screen nameOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
open-telemetry/opentelemetry-android#2309 ·
Maintainers usually reply within 1 day
-
📦 expo-location Android contributor: external needs review sdk-58 severity: medium
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day