Skip to content

Commit

Permalink
Fix linting and bump stack size
Browse files Browse the repository at this point in the history
  • Loading branch information
legnes committed Apr 21, 2024
1 parent 9087eb2 commit 8a3feab
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/reducers/builderReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ function pushToHistory(state: BuilderState): BuilderState {
return state;
}

const MAX_HISTORY_LENGTH = 20;
const MAX_HISTORY_LENGTH = 21;
const start = state.undoIndex === MAX_HISTORY_LENGTH - 1 ? 1 : 0;
const end = state.undoIndex + 1;
const undoHistory = [
Expand Down Expand Up @@ -793,15 +793,16 @@ function _builderReducer(
return { ...state, toPublish: null };
}
if (isUndoAction(action)) {
let { undoHistory, undoIndex } = state;
undoIndex = Math.max(state.undoIndex - 1, 0);
const grid = undoHistory[undoIndex];
const undoIndex = Math.max(state.undoIndex - 1, 0);
const grid = state.undoHistory[undoIndex];
return grid == null ? state : { ...state, grid, undoIndex };
}
if (isRedoAction(action)) {
let { undoHistory, undoIndex } = state;
undoIndex = Math.min(state.undoIndex + 1, state.undoHistory.length - 1);
const grid = undoHistory[undoIndex];
const undoIndex = Math.min(
state.undoIndex + 1,
state.undoHistory.length - 1
);
const grid = state.undoHistory[undoIndex];
return grid == null ? state : { ...state, grid, undoIndex };
}
return state;
Expand Down

0 comments on commit 8a3feab

Please sign in to comment.