feat: use rison for list view filters stateful urls#11675
feat: use rison for list view filters stateful urls#11675nytai merged 15 commits intoapache:masterfrom
Conversation
|
I'm confused, what in this change is actually making these filters "sticky"? |
Codecov Report
@@ Coverage Diff @@
## master #11675 +/- ##
==========================================
+ Coverage 62.86% 63.36% +0.50%
==========================================
Files 889 905 +16
Lines 43055 43891 +836
Branches 4015 4216 +201
==========================================
+ Hits 27066 27811 +745
- Misses 15811 15901 +90
- Partials 178 179 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
@nytai might need to use a different name, I think the original understanding of this feature is different from the actual implementation! I'm going based on the associated issue title. It's more a re-working of the formatting and fixing some UI bugs. |
|
@riahk I figured as much. Do you think we could rename that ticket, or at the very least this PR, to something like |
There was a problem hiding this comment.
I noticed before that all unselected filters muddy the urls, can we filter out where value === undefined?
Also did we consider going with a better/simpler data structure? maybe
{
user: ['==', 'mistercrunch'],
dataset: ['==', 'some_dataset'],
}(dataset:!(==,some_dataset),user:!(==,mistercrunch))
OR
[
["user", "==", "mistercrunch"],
["dataset", "!=", "some_dataset"]
]!(!(user,==,mistercrunch),!(dataset,'!!=',some_dataset))
You can play with structures and see resulting URLs here https://rison.io/
There was a problem hiding this comment.
I think the operators names were long too, and using things like == != IN would make for nicer/shorter URLs
There was a problem hiding this comment.
yes, this update should only put non-default filters in the URL for a much cleaner experience. I'll add some screenshots that show the URL params next to the selected filters. Also want to remove the operators but I'm working through a weird bug around that atm.
faba359 to
3e38ca0
Compare
3423ba1 to
fe8c98a
Compare
nytai
left a comment
There was a problem hiding this comment.
Looking good, just a couple suggestions
| } | ||
|
|
||
| function mergeCreateFilterValues(list: Filter[], updateList: FilterValue[]) { | ||
| function mergeCreateFilterValues(list: Filter[], updateObj: any) { |
There was a problem hiding this comment.
can we type the query filters object? something like
type QueryFilterState = {
[id: string]: [value: FilterValue["value"], operator: FilterValue["value"]]
}
There was a problem hiding this comment.
I'm also going to be modifying this file in #11702 so I'll make this change when I rebase after this is merged.
| import { BrowserRouter as Router, Route } from 'react-router-dom'; | ||
| import { QueryParamProvider } from 'use-query-params'; | ||
|
|
||
| // Wrapper component for mounting TODO: move to util file |
There was a problem hiding this comment.
Would it be possible to address this TODO before merge?
There was a problem hiding this comment.
This appears to be a util file, I think this comment just needs to be removed
SUMMARY
ListViewlogic filter logic, update URLfiltersparam to use a rison formatfiltersto only include filters set to non-default values and rm irrelevant dataFiltersUI component to properly populate selected dropdown filter (for non-async filter options)viewModeURL paramBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
use-query-paramslibstyledMount/styledShallowhelper functions to includeRouterandQueryParamProviderADDITIONAL INFORMATION