Skip to content

Commit

Permalink
fix(SystemsTable): Do not spread current params on reset
Browse files Browse the repository at this point in the history
  • Loading branch information
bastilian committed Sep 25, 2023
1 parent eb9c80e commit 210e50e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Helpers/TableToolbarHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const buildActiveFilters = (currentFilters, filterRuleValues = []) => {

export const removeFilters = (chips, apply, reset = false, defaultFilters = {}) => {
if (reset) {
apply({ ...defaultFilters, page: 1 });
apply({ ...defaultFilters, page: 1, reset });
return;
}

Expand Down
10 changes: 7 additions & 3 deletions src/Store/Reducers/SystemsPageStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ export const initialState = {
export const SystemsPageStore = (state = initialState, action) => {
let newState = { ...state };
switch (action.type) {
case ActionTypes.CHANGE_SYSTEMS_PARAMS:
case ActionTypes.CHANGE_SYSTEMS_PARAMS: {
const { reset, ...params } = action.payload;
newState.params = {
...newState.params,
...action.payload,
...!reset ? newState.params : {},
...params,
page_size: action.payload.page_size || newState.params.page_size
};

return newState;
}

case ActionTypes.CHANGE_COLUMNS_SYSTEM_LIST:
return {
...newState,
Expand Down

0 comments on commit 210e50e

Please sign in to comment.