Skip to content

Commit c9cb3de

Browse files
committed
fixed flag generation for mutable objects that support undo
1 parent 3d617d0 commit c9cb3de

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/data/model/MutableObject.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ abstract class MutableObject extends HashedObject {
2222
static prevOpsComputationLog = new Logger(MutableObject.name, LogLevel.INFO);
2323

2424
readonly _acceptedMutationOpClasses : Array<string>;
25-
readonly _supportsUndo: boolean;
2625

2726
_boundToStore : boolean;
2827

@@ -45,8 +44,6 @@ abstract class MutableObject extends HashedObject {
4544
constructor(acceptedOpClasses : Array<string>, supportsUndo=false) {
4645
super();
4746

48-
this._supportsUndo = supportsUndo;
49-
5047
if (supportsUndo) {
5148
if (acceptedOpClasses.indexOf(CascadedInvalidateOp.className) < 0) {
5249
acceptedOpClasses.push(CascadedInvalidateOp.className);
@@ -72,6 +69,10 @@ abstract class MutableObject extends HashedObject {
7269
this._externalMutationCallbacks = new Set();
7370
}
7471

72+
supportsUndo() {
73+
return this._acceptedMutationOpClasses.indexOf(CascadedInvalidateOp.className) >= 0
74+
}
75+
7576
abstract mutate(op: MutationOp): Promise<boolean>;
7677

7778
// override if appropiate
@@ -400,7 +401,7 @@ abstract class MutableObject extends HashedObject {
400401

401402
flags.push('mutable');
402403

403-
if (this._supportsUndo) {
404+
if (this.supportsUndo()) {
404405
flags.push('supports_undo')
405406
}
406407

0 commit comments

Comments
 (0)