MCPcopy Create free account
hub / github.com/ngrx/platform / computeNextEntry

Function computeNextEntry

modules/store-devtools/src/reducer.ts:55–82  ·  view source on GitHub ↗

* Computes the next entry in the log by applying an action.

(
  reducer: ActionReducer<any, any>,
  action: Action,
  state: any,
  error: any,
  errorHandler: ErrorHandler
)

Source from the content-addressed store, hash-verified

53 * Computes the next entry in the log by applying an action.
54 */
55function computeNextEntry(
56 reducer: ActionReducer<any, any>,
57 action: Action,
58 state: any,
59 error: any,
60 errorHandler: ErrorHandler
61) {
62 if (error) {
63 return {
64 state,
65 error: 'Interrupted by an error up the chain',
66 };
67 }
68
69 let nextState = state;
70 let nextError;
71 try {
72 nextState = reducer(state, action);
73 } catch (err: any) {
74 nextError = err.toString();
75 errorHandler.handleError(err);
76 }
77
78 return {
79 state: nextState,
80 error: nextError,
81 };
82}
83
84/**
85 * Runs the reducer on invalidated actions to get a fresh computation log.

Callers 2

recomputeStatesFunction · 0.85
liftReducerWithFunction · 0.85

Calls 2

reducerFunction · 0.50
handleErrorMethod · 0.45

Tested by

no test coverage detected