Allow search to show subdecks if they match the searched term#18298
Allow search to show subdecks if they match the searched term#18298david-allison merged 1 commit intoankidroid:mainfrom
Conversation
Arthur-Milchior
left a comment
There was a problem hiding this comment.
I'd appreciate one extra test, but it clearly solve the issue so fine by me
Arthur-Milchior
left a comment
There was a problem hiding this comment.
Actually, I know see another problem with your code.
If you search for "algebra", then the little icon on the left of the deck shows that "science" is not collapse, "math" is collapsed, and "algebra" is not collapsed.
The button on the left of "algebra" will allow to indeed collapse on uncollapse subdecks. The button on the left of "science" and "math" will be ignored.
I believe we should remove the buttons whose action are ignored. That is, "science" and "math" should not show any button to collapse/uncollapse.
In an ideal world, I'd keep them, if I were certain the user would understand that the impact of those button would be seen one the search is removed. However, this behavior would be very confusing, so I believe we should just remove it.
This can be left as a TODO, given that your PR is already an improvement over the current state of the codebase, I'm fine merging it once the extra tests are added
Arthur-Milchior
left a comment
There was a problem hiding this comment.
Once the issue is created and the TODO contains an explanation instead of a link I'm fine merging it
Purpose / Description
This addresses a bug where searching for a sub-deck in the deck picker would fail to return the expected deck if one of its ancestor decks was collapsed. For example, if a user has the deck structure
Science::Math::Algebra::Groupand the Math deck is collapsed, searching for "Group" would not yield theScience::Math::Algebra::Groupdeck. This is not ideal, as users should not need to remember the collapsed state of parent decks when searching for a specific sub-deck.Fixes
Approach
When searching, we'll ignore collapsed state and always search sub-decks.
How Has This Been Tested?
Manual testing + unit tests.
Demo
Screen_recording_20250511_010042.webm
Checklist