fix: keep the active search filter after deleting a track#448
Closed
MiMoHo wants to merge 1 commit into
Closed
Conversation
Deleting a selected track posts Events.RefreshFragments(), which makes MainActivity call refreshAllFragments() -> TracksFragment.setupFragment(). setupFragment reloads the full library asynchronously and calls updateItems() with the complete, unfiltered list, without re-applying the still-active search query. The search bar stays open but the list resets to the whole library. Track the active query in lastSearchQuery and re-apply it via onSearchQueryChanged() after the async reload finishes, so the filtered view (minus the deleted track) is preserved. Clear it in onSearchClosed(). Closes FossifyOrg#85
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change(s)
What changed and why
When you search on the Tracks tab and then delete one of the matching tracks, the visible list would reset to the entire library instead of staying filtered.
Deleting a selected track posts
Events.RefreshFragments().MainActivity.shouldRefreshFragments()then callsrefreshAllFragments(), which re-runsTracksFragment.setupFragment(). That method reloads the full library on a background thread and, back on the UI thread, callsupdateItems(tracks)with the complete, unfiltered list and an empty highlight string. The search bar itself stays open (the query is still held byMySearchMenu), but the fragment never re-applies it, so the user is shown the whole library again.The fix tracks the active query in a new
lastSearchQueryfield (set inonSearchQueryChanged, cleared inonSearchClosed) and, after the async reload finishes and the adapter is updated, re-applies the filter by callingonSearchQueryChanged(lastSearchQuery)when a query is still active. The filtered view (minus the deleted track) is now preserved.Tests performed
detekt,lint, unit tests and the build all pass locally (CI-equivalent).Closes the following issue(s)
Checklist
CHANGELOG.md(if applicable).Coded with Opus 4.8 ultracode.