Skip to content

Commit e7d0e44

Browse files
committed
fix(rows): Fix "deregisterFunction is not a function" error
Close angular-gantt#627
1 parent b1b4223 commit e7d0e44

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

assets/angular-gantt.js

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/dist/scripts/vendor.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51053,8 +51053,10 @@ Github: https://github.com/angular-gantt/angular-gantt.git
5105351053
var indexOf = arrays.indexOfId(this.rows, rowId, ['model', 'id']);
5105451054
if (indexOf > -1) {
5105551055
removedRow = this.rows.splice(indexOf, 1)[0]; // Remove from array
51056-
var deregisterFunction = this.rowsTaskWatchers.splice(indexOf, 1)[0]; // Remove watcher
51057-
deregisterFunction();
51056+
var unregisterFunction = this.rowsTaskWatchers.splice(indexOf, 1)[0]; // Remove watcher
51057+
if (unregisterFunction) {
51058+
unregisterFunction();
51059+
}
5105851060
}
5105951061

5106051062
arrays.removeId(this.sortedRows, rowId, ['model', 'id']);
@@ -51078,8 +51080,8 @@ Github: https://github.com/angular-gantt/angular-gantt.git
5107851080
this.visibleRows = [];
5107951081

5108051082
for (var i = 0, l = this.rowsTaskWatchers.length; i < l; i++) {
51081-
var deregisterFunction = this.rowsTaskWatchers[i];
51082-
deregisterFunction();
51083+
var unregisterFunction = this.rowsTaskWatchers[i];
51084+
unregisterFunction();
5108351085
}
5108451086
this.rowsTaskWatchers = [];
5108551087
};

src/core/logic/row/rowsManager.factory.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@
191191
var indexOf = arrays.indexOfId(this.rows, rowId, ['model', 'id']);
192192
if (indexOf > -1) {
193193
removedRow = this.rows.splice(indexOf, 1)[0]; // Remove from array
194-
var deregisterFunction = this.rowsTaskWatchers.splice(indexOf, 1)[0]; // Remove watcher
195-
deregisterFunction();
194+
var unregisterFunction = this.rowsTaskWatchers.splice(indexOf, 1)[0]; // Remove watcher
195+
if (unregisterFunction) {
196+
unregisterFunction();
197+
}
196198
}
197199

198200
arrays.removeId(this.sortedRows, rowId, ['model', 'id']);
@@ -216,8 +218,8 @@
216218
this.visibleRows = [];
217219

218220
for (var i = 0, l = this.rowsTaskWatchers.length; i < l; i++) {
219-
var deregisterFunction = this.rowsTaskWatchers[i];
220-
deregisterFunction();
221+
var unregisterFunction = this.rowsTaskWatchers[i];
222+
unregisterFunction();
221223
}
222224
this.rowsTaskWatchers = [];
223225
};

0 commit comments

Comments
 (0)