при обновлении одного редюсера почему-то сбрасываються свойства второго
import { combineReducers } from 'redux';
import filterParams from './filterParams';
import filterAjaxParams from './filterAjaxParams';
import api from './api';
export default combineReducers({
filterParams: filterParams,
filterAjaxParams: filterAjaxParams,
})
при обновлении filterAjaxParams сбрасываються свойства filterParams
const filterAjaxParams = (state = [], action) => {
switch (action.type) {
case "UPDATE_AJAX_PARAMS" :
return Object.assign({}, state, action.payload);
default: return{
types: [],
brands: [],
models: [],
years: [],
regions: [],
}
}
}
export default filterAjaxParams;
const filterParams = (state = [], action) => {
switch( action.type ){
case "UPDATE_CHANGED":
return Object.assign({}, state, action.payload );
case "UPDATE_ADVENTURE_STATE":
return Object.assign({}, state, action.payload );
default : return {
filter_models: {
adventure_state: null,
type_id: null,
bodies: [],
brands: [],
models: [],
countries: [],
ignore_countries: null,
ignore_brands: null,
ignore_models: null
},
additionally_filter: {
years: {
from: null,
to: null,
},
price: {
from: null,
to: null
},
auction_possible: null,
exchange_car: null,
inexpensive: null,
broken: null,
after_an_accident: null,
currency_id: null
},
region: {
regions: [],
cities: [],
search_neighborns: null
},
specifications: {
fuels: [],
transmissions: [],
count_doors: {
from: null,
to: null
},
seats_number: {
from: null,
to: null
},
volume: {
from: null,
to: null
},
power: {
from: null,
to: null
},
race: {
from: null,
to: null
},
colors: {
items: [],
metallic: null
},
options: []
},
page: null,
sort: null,
period: null
};
}
}
export default filterParams;
я обновляю filterAjaxParams.years
но при етом сбрасываються свойства filterParams