instrument

This commit is contained in:
Nathan Bierema 2024-08-04 19:23:52 -04:00
parent 96db5f50b6
commit 6e5985693a

View File

@ -137,7 +137,7 @@ export const ActionCreators = {
action: A, action: A,
trace?: ((action: A) => string | undefined) | boolean, trace?: ((action: A) => string | undefined) | boolean,
traceLimit?: number, traceLimit?: number,
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
toExcludeFromTrace?: Function, toExcludeFromTrace?: Function,
) { ) {
if (!isPlainObject(action)) { if (!isPlainObject(action)) {
@ -281,7 +281,6 @@ function computeWithTryCatch<S, A extends Action<string>>(
try { try {
nextState = reducer(state, action); nextState = reducer(state, action);
} catch (err) { } catch (err) {
// eslint-disable-next-line @typescript-eslint/ban-types
nextError = (err as object).toString(); nextError = (err as object).toString();
if (isChrome) { if (isChrome) {
// In Chrome, rethrowing provides better source map support // In Chrome, rethrowing provides better source map support
@ -346,7 +345,7 @@ function recomputeStates<S, A extends Action<string>>(
const previousEntry = nextComputedStates[i - 1]; const previousEntry = nextComputedStates[i - 1];
const previousState = previousEntry ? previousEntry.state : committedState; const previousState = previousEntry ? previousEntry.state : committedState;
const shouldSkip = skippedActionIds.indexOf(actionId) > -1; const shouldSkip = skippedActionIds.includes(actionId);
let entry; let entry;
if (shouldSkip) { if (shouldSkip) {
entry = previousEntry; entry = previousEntry;
@ -378,7 +377,7 @@ function liftAction<A extends Action<string>>(
action: A, action: A,
trace?: ((action: A) => string | undefined) | boolean, trace?: ((action: A) => string | undefined) | boolean,
traceLimit?: number, traceLimit?: number,
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
toExcludeFromTrace?: Function, toExcludeFromTrace?: Function,
) { ) {
return ActionCreators.performAction( return ActionCreators.performAction(
@ -477,7 +476,7 @@ function liftReducerWith<
} }
skippedActionIds = skippedActionIds.filter( skippedActionIds = skippedActionIds.filter(
(id) => idsToDelete.indexOf(id) === -1, (id) => !idsToDelete.includes(id),
); );
stagedActionIds = [0, ...stagedActionIds.slice(excess + 1)]; stagedActionIds = [0, ...stagedActionIds.slice(excess + 1)];
committedState = computedStates[excess].state; committedState = computedStates[excess].state;