Maintain selected sort option when toggling filters #11849
+8
−1
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.
In the database health report view:
If you sort by a column, then toggle one of the filters (show excluded, show expired) the user selected sort option is lost.
It tries to reset to sorting by the first column (quality) in ascending order. But that doesn't work either, you need to manually sort again. Or toggle filter again to get the "default sort" to actually take effect.
This PR stores the user sort option and restores it after filtering. Because it seems more like expected behavior from a user perspective.
Also valid is to fix the default sort, so it actually does reset the order when a filter has been toggled.
Screenshots
Old version
Step 1: Sort by score/descending
Step 2: Toggle show excluded entries. UI indicates the table is sorted by quality/ascending. But it's not, it's still the previous sort: score/descending.
Step 3: Toggle show excluded entries again. Now it's actually reset and displaying quality/ascending
New version
Step 1: Sort by score/descending
Step 2: Toggle show excluded entries. Sorting is kept to user choice score/descending.
Step 3: Toggling show excluded entries again. Sorting is kept to user choice score/descending.
Testing strategy
Created multiple passwords with different qualities.
Created expired password.
Exclude a password.
Then toggle and sort in every direction
Type of change