Nearby: persist place-type filters across tab switches (Fixes #6486) #6509
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.
Fixes #6486
What changes did you make and why?
When switching away from Nearby and returning, the place-type chips remained visually selected but the map/list reset to unfiltered pins.
This PR ensures the selected place-type filters are persisted and restored within the same app session:
Persist selection on every change
In
NearbyFilterSearchRecyclerViewAdapter:NearbyFilterState.setSelectedLabels(new ArrayList<>(selectedLabels))and thencallback.filterByMarkerType(...).setRecyclerViewAdapterItemsGreyedOut) and Select all (setRecyclerViewAdapterAllSelected) operations, also updateNearbyFilterStateto keep state consistent.Restore selection on Nearby init
In
NearbyParentFragment:restoreStoredFilterSelection()and call it frominitNearbyFilter()to re-apply saved labels toLabelenum states and the adapter, thennotifyDataSetChanged()so the UI, map, and list stay aligned with the saved filters.searchViewstate (de-iconify, clear query, remove focus) to avoid stale focus interfering with sheet/filters.Scope: persistence is within the current app session.
Tests performed (required)
debug-main(Commons app6.0.2-debug-main~4ed9ad508)Manual scenarios
1.Open the app and grant location permission.
2.Go to the Nearby tab.
3.Select one or more place-type chips (any types are fine).
4.Observe: the map updates and shows only the selected types.
5.Switch to another tab (e.g., Contributions / Explore).
6.Switch back to Nearby.
7.Observe: the chips are still selected, and now the map shows selected pins
Screenshots (for UI changes only)
Before:



After repair:


