Skip to content

Commit

Permalink
remove removeFilterByOwner action
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier authored and Javier committed Dec 1, 2021
1 parent e5b9a87 commit e1c007c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
8 changes: 0 additions & 8 deletions packages/react-redux/src/slices/cartoSlice.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ declare enum CartoActions {
SET_BASEMAP = 'carto/setBasemap',
ADD_FILTER = 'carto/addFilter',
REMOVE_FILTER = 'carto/removeFilter',
REMOVE_FILTER_BY_OWNER = 'carto/removeFilterByOwner',
CLEAR_FILTERS = 'carto/clearFilters',
SET_VIEWPORT_FEATURES = 'carto/setViewportFeatures',
REMOVE_VIEWPORT_FEATURES = 'carto/removeViewportFeatures',
Expand Down Expand Up @@ -116,13 +115,6 @@ export function removeFilter(
payload: FilterCommonProps;
};

export function removeFilterByOwner(
arg: { id: string, owner: string }
): {
type: CartoActions.REMOVE_FILTER_BY_OWNER;
payload: { id: string, owner: string };
};

export function clearFilters(
id: string
): {
Expand Down
27 changes: 0 additions & 27 deletions packages/react-redux/src/slices/cartoSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,6 @@ export const createCartoSlice = (initialState) => {
delete source.filters[column];
}
},
removeFilterByOwner: (state, action) => {
const { id, owner } = action.payload;
const filtersToRemove = [];

Object.entries(state.dataSources[id]?.filters || {}).forEach(
([column, filter]) => {
Object.entries(filter || {}).forEach(([, type]) => {
if (type.owner === owner) {
filtersToRemove.push({ id, column });
}
});
}
);
filtersToRemove.forEach((filter) => {
delete state?.dataSources[filter.id]?.filters[filter.column];
});
},
clearFilters: (state, action) => {
const { id } = action.payload;
const source = state.dataSources[id];
Expand Down Expand Up @@ -250,16 +233,6 @@ export const removeFilter = ({ id, column }) => ({
payload: { id, column }
});

/**
* Action to remove filter by widget owner
* @param {id} - sourceId of the filter to remove
* @param {owner} - widgetId of the filter to remove
*/
export const removeFilterByOwner = ({ id, owner }) => ({
type: 'carto/removeFilterByOwner',
payload: { id, owner }
});

/**
* Action to remove all filters from a source
* @param {id} - sourceId
Expand Down

0 comments on commit e1c007c

Please sign in to comment.