mirror of
https://github.com/grafana/grafana.git
synced 2026-02-03 20:49:50 -05:00
* Complete decoupling of backend - Replace usage of featuremgmt - Copy simplejson - Add standalone logic * Complete frontend decoupling - Fix imports - Copy store and reducer logic * Add required files for full decoupling * Regen cue * Prettier * Remove unneeded script * Jest fix * Add jest config * Lint * Lit * Prune suppresions
21 lines
582 B
TypeScript
21 lines
582 B
TypeScript
import { ReducersMapObject } from '@reduxjs/toolkit';
|
|
import { Action as AnyAction, combineReducers } from 'redux';
|
|
|
|
const addedReducers = {
|
|
defaultReducer: (state = {}) => state,
|
|
templating: (state = { lastKey: 'key' }) => state,
|
|
};
|
|
|
|
export const addReducer = (newReducers: ReducersMapObject) => {
|
|
Object.assign(addedReducers, newReducers);
|
|
};
|
|
|
|
export const createRootReducer = () => {
|
|
const appReducer = combineReducers({
|
|
...addedReducers,
|
|
});
|
|
|
|
return (state: Parameters<typeof appReducer>[0], action: AnyAction) => {
|
|
return appReducer(state, action);
|
|
};
|
|
};
|