nytai commented on a change in pull request #11675:
URL:
https://github.com/apache/incubator-superset/pull/11675#discussion_r525906565
##########
File path: superset-frontend/src/components/ListView/utils.ts
##########
@@ -189,27 +221,48 @@ export function useListViewState({
);
const [internalFilters, setInternalFilters] = useState<InternalFilter[]>(
- query.filters || [],
+ query.filters && initialFilters.length
+ ? mergeCreateFilterValues(initialFilters, query.filters)
+ : [],
);
useEffect(() => {
if (initialFilters.length) {
setInternalFilters(
- mergeCreateFilterValues(initialFilters, query.filters || []),
+ mergeCreateFilterValues(
+ initialFilters,
+ query.filters ? query.filters : {},
+ ),
);
}
}, [initialFilters]);
useEffect(() => {
+ // From internalFilters, produce a simplified obj
+ const filterObj = {};
+
+ internalFilters.forEach(filter => {
+ if (
+ filter.value !== undefined &&
+ (typeof filter.value !== 'string' || filter.value.length > 0)
+ ) {
+ filterObj[filter.id] = [filter.value, filter.operator];
Review comment:
As per your TODO above, we could probably even get rid of the operator
since that value is static and set in code. I doubt we want to support swapping
filter operators in the url.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]