diff --git a/libs/ngrx-toolkit/src/lib/with-undo-redo.ts b/libs/ngrx-toolkit/src/lib/with-undo-redo.ts index b38de84..e742f8f 100644 --- a/libs/ngrx-toolkit/src/lib/with-undo-redo.ts +++ b/libs/ngrx-toolkit/src/lib/with-undo-redo.ts @@ -161,6 +161,16 @@ SignalStoreFeature { return; } + // + // Deep Comparison to prevent duplicated entries + // on the stack. This can e.g. happen after an undo + // if the component sends back the undone filter + // to the store. + // + if(JSON.stringify(cand) === JSON.stringify(previous)) { + return; + } + // Clear redoStack after recorded action redoStack.splice(0);