Skip to content

Commit

Permalink
removes the query deletion from this changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu committed May 21, 2020
1 parent d8ae19e commit 2118c52
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions packages/core-data/src/queried-data/reducer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { map, flowRight, omit, remove } from 'lodash';
import { map, flowRight, omit } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -89,19 +89,6 @@ function items( state = {}, action ) {
return state;
}

const removeQueryItems = () => ( reducer ) => ( state, action ) => {
const reconciledState = { ...state };
if ( action.type === 'REMOVE_ITEMS' ) {
action.query.forEach( ( queryId ) => {
remove( reconciledState[ '' ], ( stateQueryId ) => {
return queryId === stateQueryId;
} );
} );
}
const nextState = reducer( reconciledState, action );
return nextState;
};

/**
* Reducer tracking queries state, keyed by stable query key. Each reducer
* query object includes `itemIds` and `requestingPageByPerPage`.
Expand All @@ -115,7 +102,6 @@ const queries = flowRight( [
// Limit to matching action type so we don't attempt to replace action on
// an unhandled action.
ifMatchingAction( ( action ) => 'query' in action ),
removeQueryItems(),
// Inject query parts into action for use both in `onSubKey` and reducer.
replaceAction( ( action ) => {
// `ifMatchingAction` still passes on initialization, where state is
Expand Down

0 comments on commit 2118c52

Please sign in to comment.