-
Notifications
You must be signed in to change notification settings - Fork 396
/
index.js
47 lines (43 loc) · 1.19 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// @flow
import profileView from './profile-view';
import app from './app';
import urlState from './url-state';
import icons from './icons';
import zippedProfiles from './zipped-profiles';
import publish from './publish';
import l10n from './l10n';
import code from './code';
import { combineReducers } from 'redux';
import type { Reducer, State } from 'firefox-profiler/types';
/**
* This function provides a mechanism to swap out to an old state that we have
* retained.
*/
const wrapReducerInResetter = (
regularRootReducer: Reducer<State>
): Reducer<State> => {
return (state, action) => {
switch (action.type) {
case 'REVERT_TO_PRE_PUBLISHED_STATE':
return action.prePublishedState;
default:
return regularRootReducer(state, action);
}
};
};
const rootReducer: Reducer<State> = wrapReducerInResetter(
combineReducers({
app,
profileView,
urlState,
icons,
zippedProfiles,
publish,
l10n,
code,
})
);
export default rootReducer;