Skip to content

Commit 89332b6

Browse files
docs: mention clearUndoRedo soft/hard (#278)
1 parent d9f48b4 commit 89332b6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/docs/with-undo-redo.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Example:
1212

1313
```typescript
1414
import { withUndoRedo } from '@angular-architects/ngrx-toolkit';
15+
import { clearUndoRedo } from '@angular-architects/ngrx-toolkit';
1516

1617
const SyncStore = signalStore(
1718
withUndoRedo({
@@ -32,7 +33,6 @@ public class UndoRedoComponent {
3233

3334
canUndo = this.store.canUndo; // use in template or in ts
3435
canRedo = this.store.canRedo; // use in template or in ts
35-
clearStack = this.store.clearStack; // use in template or in ts
3636

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

4747
clearStack(): void {
48+
// Does a soft reset (not setting the state to `null`) by default.
4849
clearUndoRedo(this.store);
50+
51+
// The hard reset can be set via options,
52+
// clearUndoRedo(store, { lastRecord: null })
4953
}
5054
}
5155
```

0 commit comments

Comments
 (0)