summaryrefslogtreecommitdiff
blob: 1a1fc13897b9ca81d9cb9a0715d342906e8afd79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
 * Internal dependencies
 */
import { SET_JETPACK_SETTINGS } from '../actions/jetpack-settings';

const jetpackSettings = ( state = {}, action ) => {
	switch ( action.type ) {
		case SET_JETPACK_SETTINGS:
			return {
				...state,
				...action.options,
				is_toggling_module:
					state.module_active !== action.options.module_active && !! action.options.is_updating,
				is_toggling_instant_search:
					state.instant_search_enabled !== action.options.instant_search_enabled &&
					!! action.options.is_updating,
			};
	}
	return state;
};

export default jetpackSettings;