Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/docs/with-undo-redo.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Example:

```typescript
import { withUndoRedo } from '@angular-architects/ngrx-toolkit';
import { clearUndoRedo } from '@angular-architects/ngrx-toolkit';

const SyncStore = signalStore(
withUndoRedo({
Expand All @@ -32,7 +33,6 @@ public class UndoRedoComponent {

canUndo = this.store.canUndo; // use in template or in ts
canRedo = this.store.canRedo; // use in template or in ts
clearStack = this.store.clearStack; // use in template or in ts

undo(): void {
if (!this.canUndo()) return;
Expand All @@ -45,7 +45,11 @@ public class UndoRedoComponent {
}

clearStack(): void {
// Does a soft reset (not setting the state to `null`) by default.
clearUndoRedo(this.store);

// The hard reset can be set via options,
// clearUndoRedo(store, { lastRecord: null })
}
}
```