Skip to content

Commit 54effcd

Browse files
committed
refactor(history): cleaning tree history
1 parent 17d4ee0 commit 54effcd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

projects/interacto-angular/src/lib/components/tree-history/tree-history.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,23 @@ export class TreeHistoryComponent {
6969
protected divHistory: ElementRef<HTMLDivElement>;
7070

7171
public constructor(protected history: TreeUndoHistory,
72-
// private changeDetect: ChangeDetectorRef,
7372
private readonly sanitizer: DomSanitizer) {
74-
// Observing the undo history, but with a throttle to avoid useless updates.
73+
// Observing the undo history, but with a throttle to avoid useless updates.
7574
this.undos = toSignal<Undoable | number | undefined>(
7675
concat(this.history.sizeObservable(), this.history.undosObservable(), this.history.redosObservable())
7776
.pipe(throttleTime(200)));
7877

79-
// Computing the list of thumnbails
78+
// Computing the list of thumbnails
8079
this.thumbnails = computed(() => {
80+
// The use of undos() here is useless, but required to trigger the computation.
81+
this.undos();
8182
// Do not need to observe rootRendered.
8283
this.cacheRoot = untracked(this.rootRenderer);
8384

8485
return [...this.history.getPositions().entries()].map(entry => ({
8586
"key": entry[0],
8687
"value": entry[1],
87-
// The use of undos() here is useless, but required to trigger the computation.
88-
"thumbnail": this.undoButtonSnapshot(this.history.undoableNodes[entry[0]], this.undos())
88+
"thumbnail": this.undoButtonSnapshot(this.history.undoableNodes[entry[0]])
8989
} satisfies Thumbnail));
9090
});
9191
}
@@ -147,7 +147,7 @@ export class TreeHistoryComponent {
147147
return txt;
148148
}
149149

150-
protected async undoButtonSnapshot(node: UndoableTreeNode | undefined, _ignore: Undoable | number | undefined): Promise<unknown> {
150+
protected async undoButtonSnapshot(node: UndoableTreeNode | undefined): Promise<unknown> {
151151
if (node === undefined) {
152152
if (this.cacheRoot === undefined) {
153153
this.cacheRoot = this.rootRenderer();

0 commit comments

Comments
 (0)