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

Function commitExcessActions

modules/store-devtools/src/reducer.ts:194–218  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

192 }
193
194 function commitExcessActions(n: number) {
195 // Auto-commits n-number of excess actions.
196 let excess = n;
197 let idsToDelete = stagedActionIds.slice(1, excess + 1);
198
199 for (let i = 0; i < idsToDelete.length; i++) {
200 if (computedStates[i + 1].error) {
201 // Stop if error is found. Commit actions up to error.
202 excess = i;
203 idsToDelete = stagedActionIds.slice(1, excess + 1);
204 break;
205 } else {
206 delete actionsById[idsToDelete[i]];
207 }
208 }
209
210 skippedActionIds = skippedActionIds.filter(
211 (id) => idsToDelete.indexOf(id) === -1
212 );
213 stagedActionIds = [0, ...stagedActionIds.slice(excess + 1)];
214 committedState = computedStates[excess].state;
215 computedStates = computedStates.slice(excess);
216 currentStateIndex =
217 currentStateIndex > excess ? currentStateIndex - excess : 0;
218 }
219
220 function commitChanges() {
221 // Consider the last committed state the new starting point.

Callers 1

liftReducerWithFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected