You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/01/25 14:37:26 UTC
[GitHub] [superset] agatapst commented on a change in pull request #12716: feat(native-filters): apply scoping of native filters to dashboard
agatapst commented on a change in pull request #12716:
URL: https://github.com/apache/superset/pull/12716#discussion_r563770537
##########
File path: superset-frontend/src/dashboard/reducers/nativeFilters.ts
##########
@@ -36,14 +36,17 @@ export function getInitialFilterState(id: string): FilterState {
export function getInitialState(
filterConfig: FilterConfiguration,
+ prevFiltersState: { [filterId: string]: FilterState },
): NativeFiltersState {
const filters = {};
const filtersState = {};
const state = { filters, filtersState };
filterConfig.forEach(filter => {
const { id } = filter;
filters[id] = filter;
- filtersState[id] = getInitialFilterState(id);
+ filtersState[id] = !prevFiltersState?.[id]
+ ? getInitialFilterState(id)
+ : prevFiltersState[id];
Review comment:
Maybe we can just simplify to:
```
filtersState[id] = prevFiltersState?.[id] || getInitialFilterState(id)
```
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org