Skip to content

Commit fc22cb6

Browse files
committed
undo-state.component: return same state on validation failed
1 parent 3e6d483 commit fc22cb6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

projects/angular-redux2/undo/src/components/undo-state.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class NgUndoStateActions {
8080
const { state, undoState } = this.getStates(currentState);
8181

8282
if (undoState.past.length === 0) {
83-
return state;
83+
return currentState;
8484
}
8585

8686
const pastSnapshot = undoState.past.pop();
@@ -102,7 +102,7 @@ export class NgUndoStateActions {
102102
const { state, undoState } = this.getStates(currentState);
103103

104104
if (undoState.future.length === 0) {
105-
return state;
105+
return currentState;
106106
}
107107

108108
const futureSnapshot = undoState.future.shift();
@@ -160,7 +160,7 @@ export class NgUndoStateActions {
160160
const { state, undoState } = this.getStates(currentState);
161161

162162
if (index < 0 || index >= undoState.future.length) {
163-
return state;
163+
return currentState;
164164
}
165165

166166
const snapshot = get(state, this.path);
@@ -186,7 +186,7 @@ export class NgUndoStateActions {
186186
const { state, undoState } = this.getStates(currentState);
187187

188188
if (index < 0 || index >= undoState.past.length) {
189-
return state;
189+
return currentState;
190190
}
191191

192192
const snapshot = get(state, this.path);

0 commit comments

Comments
 (0)