MCPcopy
hub / github.com/appsmithorg/appsmith / createReducer

Function createReducer

app/client/src/utils/ReducerUtils.ts:5–22  ·  view source on GitHub ↗
(
  // TODO: Fix this the next time the file is edited
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  initialState: any,
  // TODO: Fix this the next time the file is edited
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  handlers: { [type: string]: (state: any, action: any) => any },
)

Source from the content-addressed store, hash-verified

3import { create } from "mutative";
4
5export const createReducer = (
6 // TODO: Fix this the next time the file is edited
7 // eslint-disable-next-line @typescript-eslint/no-explicit-any
8 initialState: any,
9 // TODO: Fix this the next time the file is edited
10 // eslint-disable-next-line @typescript-eslint/no-explicit-any
11 handlers: { [type: string]: (state: any, action: any) => any },
12) => {
13 // TODO: Fix this the next time the file is edited
14 // eslint-disable-next-line @typescript-eslint/no-explicit-any
15 return function reducer(state = initialState, action: ReduxAction<any>) {
16 if (handlers.hasOwnProperty(action.type)) {
17 return handlers[action.type](state, action);
18 } else {
19 return state;
20 }
21 };
22};
23
24export const createImmerReducer = (
25 // TODO: Fix this the next time the file is edited

Calls

no outgoing calls

Tested by

no test coverage detected