redux#combineReducers TypeScript Examples
The following examples show how to use
redux#combineReducers.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: emu-renderer.tsx From kliveide with MIT License | 6 votes |
// ------------------------------------------------------------------------------
// --- Register the main services
// --- Application state store (redux)
registerService(
STORE_SERVICE,
new KliveStore(
createStore(
combineReducers(appReducers),
getInitialAppState(),
applyMiddleware(forwardToMainMiddleware)
)
)
);
Example #2
Source File: AsyncUtils.ts From generator-earth with MIT License | 6 votes |
/**
* inject async reducers object into store
*/
export function injectReducer(asyncReducers/*obj*/) {
store.allReducers = {
...store.allReducers,
...asyncReducers,
}
store.replaceReducer( combineReducers(store.allReducers) )
}
Example #3
Source File: reducers.tsx From avalon.ist with MIT License | 6 votes |
rootReducer = combineReducers({ notes, username, online, highlighted, chatHighlights, messageDelay, style, missionHighlight, })
Example #4
Source File: store.ts From THUInfo with MIT License | 6 votes |
rootReducer = combineReducers({
auth: persistReducer(
{
keyPrefix: "com.unidy2002.thuinfo.persist.auth.",
storage: KeychainStorage,
key: "auth",
},
auth,
),
schedule,
config,
credentials: persistReducer(
{
keyPrefix: "com.unidy2002.thuinfo.persist.credentials.",
storage: KeychainStorage,
key: "credentials",
},
credentials,
),
top5,
reservation,
})
Example #5
Source File: reducers.ts From react-app-architecture with Apache License 2.0 | 6 votes |
rootReducer = combineReducers<RootState>({ appState: appReducer, authState: authReducer, blogListState: blogListReducer, blogState: blogReducer, writerBlogsState: writerBlogsReducer, writingPadState: writingPadReducer, editorBlogState: editorBlogsReducer, })
Example #6
Source File: reducer.ts From aqualink-app with MIT License | 6 votes |
appReducer = combineReducers({ selectedSite, sitesList, homepage, user, collection, survey, surveyList, uploads, })
Example #7
Source File: rootReducer.spec.ts From diagram-maker with Apache License 2.0 | 6 votes |
describe('getRootReducer', () => {
it('calls combineReducers from redux', () => {
getRootReducer();
expect(combineReducers).toHaveBeenCalledWith({
edges: edgeReducer,
editor: editorReducer,
nodes: nodeReducer,
panels: panelReducer,
plugins: pluginReducer,
potentialEdge: potentialEdgeReducer,
potentialNode: potentialNodeReducer,
undoHistory: undoHistoryReducer,
workspace: workspaceReducer,
});
});
});
Example #8
Source File: configureStore.ts From che-dashboard-next with Eclipse Public License 2.0 | 6 votes |
export default function configureStore(history: History, initialState?: AppState): Store {
const middleware = [
thunk,
routerMiddleware(history)
];
const rootReducer = combineReducers({
...reducers,
router: connectRouter(history)
});
const enhancers: any[] = [];
const windowIfDefined = typeof window === 'undefined' ? null : window as any;
if (windowIfDefined && windowIfDefined.__REDUX_DEVTOOLS_EXTENSION__) {
enhancers.push(windowIfDefined.__REDUX_DEVTOOLS_EXTENSION__() as any);
}
return createStore(
rootReducer,
initialState,
compose(applyMiddleware(...middleware), ...enhancers)
);
}
Example #9
Source File: server.ts From clearflask with Apache License 2.0 | 6 votes |
reducers = combineReducers({
projectId: reducerProjectId,
settings: reducerSettings,
conf: reducerConf,
drafts: reducerDrafts,
ideas: reducerIdeas,
comments: reducerComments,
users: reducerUsers,
votes: reducerVotes,
commentVotes: reducerCommentVotes,
credits: reducerCredits,
notifications: reducerNotifications,
teammates: reducerTeammates,
...({
loadingBar: loadingBarReducer,
} as {}),
})
Example #10
Source File: rootReducer.ts From nosgestesclimat-site with MIT License | 6 votes |
mainReducer = (state: any, action: Action) =>
combineReducers({
explainedVariable,
// We need to access the `rules` in the simulation reducer
simulation: (a: Simulation | null = null, b: Action): Simulation | null =>
simulation(a, b),
previousSimulation: defaultTo(null) as Reducer<SavedSimulation | null>,
situationBranch,
rules,
actionChoices,
conference,
survey,
iframeOptions: defaultTo(null),
tutorials,
storedTrajets,
thenRedirectTo,
tracking,
})(state, action)
Example #11
Source File: store.ts From extension with MIT License | 6 votes |
rootReducer = combineReducers({ bookmarks: bookmarksReducer, navigation: navigationReducer, editing: editingReducer, auth: authReducer, backup: backupReducer, tags: tagsReducer, settings: settingsReducer, })
Example #12
Source File: App.ts From YoutubeLiveApp with MIT License | 6 votes |
constructor(app: App) {
this.app = app;
this.app.on("ready", this.onReady);
this.app.on("window-all-closed", this.onWindowAllClosed);
const packageJson = fs.readFileSync(packageJsonPath);
const packageJsonObject = JSON.parse(packageJson.toString("utf-8"));
this.version = packageJsonObject.version;
this.bouyomiChan = new BouyomiChan({
port: this.bouyomiChanPort,
});
const initialState = resumeData();
this.isAlwaysOnTop = !!initialState.isAlwaysOnTop;
this.serverRunning = !!initialState.fixedChatUrl;
const reducer = combineReducers({ app: createAppReducer(initialState), chat: createChatReducer(chatInitialState) });
const myCreateStore = compose(applyMiddleware(MainProcessMiddleware()))(createStore);
this.store = myCreateStore(reducer);
}
Example #13
Source File: index.ts From multisig-react with MIT License | 6 votes |
reducers = combineReducers({ router: connectRouter(history), [PROVIDER_REDUCER_ID]: provider, [SAFE_REDUCER_ID]: safe, [NFT_ASSETS_REDUCER_ID]: nftAssetReducer, [NFT_TOKENS_REDUCER_ID]: nftTokensReducer, [TOKEN_REDUCER_ID]: tokens, [TRANSACTIONS_REDUCER_ID]: transactions, [CANCELLATION_TRANSACTIONS_REDUCER_ID]: cancellationTransactions, [INCOMING_TRANSACTIONS_REDUCER_ID]: incomingTransactions, [MODULE_TRANSACTIONS_REDUCER_ID]: moduleTransactions, [NOTIFICATIONS_REDUCER_ID]: notifications, [CURRENCY_VALUES_KEY]: currencyValues, [COOKIES_REDUCER_ID]: cookies, [ADDRESS_BOOK_REDUCER_ID]: addressBook, [CURRENT_SESSION_REDUCER_ID]: currentSession, [TRANSACTIONS]: allTransactions, })
Example #14
Source File: index.ts From idena-pocket with MIT License | 6 votes |
store = (() => {
const store = createStore(
combineReducers({
router: connectRouter(history),
app: rootReducer(defaultState)
}),
compose(
applyMiddleware(routerMiddleware(history), ...middlewares),
...(process.env.NODE_ENV === 'development' && devtools
? [devtools()]
: [])
)
)
if ((module as any).hot) {
// Enable Webpack hot module replacement for reducers
;(module as any).hot.accept('../reducer', () => {
const nextRootReducer = require('../reducer')
store.replaceReducer(nextRootReducer)
})
}
return store
})()
Example #15
Source File: AppState.ts From desktop-starter with MIT License | 6 votes |
constructor() {
// this is the rootReducer for the application.
this._rootReducer = combineReducers<RootState>({
switchIModelState: AppReducer,
frameworkState: FrameworkReducer,
} as any);
// create the Redux Store.
this._store = createStore(this._rootReducer,
(window as any).__REDUX_DEVTOOLS_EXTENSION__ && (window as any).__REDUX_DEVTOOLS_EXTENSION__());
}
Example #16
Source File: rootReducer.ts From foodie with MIT License | 6 votes |
rootReducer = combineReducers({ auth: authReducer, error: errorReducer, loading: loadingReducer, newsFeed: newsFeedReducer, profile: profileReducer, chats: chatReducer, helper: helperReducer, modal: modalReducer, settings: settingsReducer, })
Example #17
Source File: index.ts From TabMerger with GNU General Public License v3.0 | 6 votes |
rootReducer = combineReducers({
header: headerReducer,
dnd: dndReducer,
modal: modalReducer,
groups: undoable(groupsReducer, {
filter: excludeAction(EXCLUDED_ACTIONS),
groupBy: (actionType) => {
const matchType = DND_GROUPING[DND_GROUPING.length - 1];
const groupingId = DND_GROUPING.includes(actionType.type) ? matchType + "-" + randomGroupPostfix : null;
// Want to update the random postfix after the final group's `groupingId` is updated
if (actionType.type === matchType) {
randomGroupPostfix = Math.random();
}
return groupingId;
},
syncFilter: true
})
})
Example #18
Source File: index.ts From fe-v5 with Apache License 2.0 | 6 votes |
private getReducer(): reducer {
let reducers: reducers = {};
for (let m of this._models) {
// m是每个model的配置
reducers[m.namespace] = function (state = m.state, action) {
// 组织每个模块的reducer
let everyreducers = m.reducers; // reducers的配置对象,里面是函数
let reducer = everyreducers[action.type]; // 相当于以前写的switch
if (reducer) {
return reducer(state, action);
}
return state;
};
}
let extraReducers = this.plugin.get('extraReducers');
return combineReducers({ ...reducers, ...extraReducers }); //reducer结构{reducer1:fn,reducer2:fn}
}
Example #19
Source File: reducer.ts From nextclade with MIT License | 6 votes |
rootReducer = () =>
combineReducers({
// BEGIN reducers from auspice
metadata,
tree,
frequencies,
controls,
entropy,
browserDimensions,
notifications,
narrative,
treeToo,
general: auspiceGeneralReducer,
query: auspiceQueryReducer,
measurements,
// END reducers from auspice
})
Example #20
Source File: index.tsx From nouns-monorepo with GNU General Public License v3.0 | 6 votes |
createRootReducer = (history: History) =>
combineReducers({
router: connectRouter(history),
account,
application,
auction,
logs,
pastAuctions,
onDisplayAuction,
})
Example #21
Source File: index.ts From tezos-academy with MIT License | 6 votes |
reducers = (history: any) =>
combineReducers({
router: connectRouter(history),
auth,
loading,
users,
toaster,
drawer,
progressBar,
serviceWorker,
})
Example #22
Source File: index.ts From ui with GNU Affero General Public License v3.0 | 6 votes |
root = (state: State, action: AnyAction): State => {
switch (action.type) {
case HYDRATE:
return { ...state, ...action.payload } as State
}
const combined = combineReducers({
auth,
})
return combined(state, action)
}
Example #23
Source File: store.ts From OpenBA-NextGenTV with MIT License | 6 votes |
rootReducer = combineReducers({ cta: ctaReducer, alert: alertReducer, device: deviceReducer, appConfig: appConfigReducer, weather: weatherReducer, feeds: feedsReducer, userSettings: userSettingsReducer, skeletonMenu: skeletonMenuReducer, fileList: fileListReducer, radios: radiosReducer, })
Example #24
Source File: index.ts From orangehrm-os-mobile with GNU General Public License v3.0 | 6 votes |
rootReducer = combineReducers({ auth: authReducer, theme: themeReducer, storage: storageReducer, globals: globalsReducer, leaveUsage: leaveUsageReducer, applyLeave: applyLeaveReducer, leaveList: leaveListReducer, assignLeave: assignLeaveReducer, leaveCommon: leaveCommonReducer, punch: punchReducer, attendance: attendanceReducer, help: helpConfigReducer, })
Example #25
Source File: rootReducer.ts From deskreen with GNU Affero General Public License v3.0 | 6 votes |
// eslint-disable-next-line import/no-cycle
// import counterReducer from './features/counter/counterSlice';
export default function createRootReducer(history: History) {
return combineReducers({
router: connectRouter(history),
// counter: counterReducer,
});
}
Example #26
Source File: store.ts From openchakra with MIT License | 6 votes |
storeConfig = {
models,
redux: {
// @ts-ignore
combineReducers: reducers => {
return combineReducers({
...reducers,
components: persistReducer(
persistConfig,
undoable(reducers.components, {
limit: 10,
filter: filterUndoableActions,
}),
),
})
},
},
plugins: [persistPlugin],
}
Example #27
Source File: reducer.ts From slice-machine with Apache License 2.0 | 6 votes |
createReducer = (): Reducer =>
combineReducers({
modal: modalReducer,
loading: loadingReducer,
userContext: userContextReducer,
environment: environmentReducer,
simulator: simulatorReducer,
availableCustomTypes: availableCustomTypesReducer,
selectedCustomType: selectedCustomTypeReducer,
slices: slicesReducer,
router: routerReducer,
})
Example #28
Source File: reducers.ts From pybricks-code with MIT License | 6 votes |
rootReducer = combineReducers({ app, bootloader, ble, editor, explorer, fileStorage, firmware, hub, })
Example #29
Source File: root.ts From grafana-chinese with Apache License 2.0 | 6 votes |
createRootReducer = () => {
const appReducer = combineReducers({
...rootReducers,
...addedReducers,
});
return (state: any, action: AnyAction): any => {
if (action.type !== cleanUpAction.type) {
return appReducer(state, action);
}
const { stateSelector } = action.payload as CleanUp<any>;
const stateSlice = stateSelector(state);
recursiveCleanState(state, stateSlice);
return appReducer(state, action);
};
}