Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Commit

Permalink
LineGraph: Add an existingItemsMap to check if items are new or not b…
Browse files Browse the repository at this point in the history
…efore skipping
  • Loading branch information
Angelo Youn committed May 19, 2017
1 parent f67d16c commit f7d59fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/timeline/component/LineGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,15 @@ LineGraph.prototype._updateAllGroupData = function (ids, groupIds) {
}

//Pre-load arrays from existing groups if items are not changed (not in ids)
var existingItemsMap = {};
if (!groupIds && ids) {
for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) {
var group = this.groups[groupId];
var existing_items = group.getItems();

groupsContent[groupId] = existing_items.filter(function (item) {
existingItemsMap[fieldId] = fieldId;
return (item[fieldId] !== idMap[item[fieldId]]);
});
var newLength = groupCounts[groupId];
Expand All @@ -478,7 +480,7 @@ LineGraph.prototype._updateAllGroupData = function (ids, groupIds) {
if (groupId === null || groupId === undefined) {
groupId = UNGROUPED;
}
if (!groupIds && ids && (item[fieldId] !== idMap[item[fieldId]])) {
if (!groupIds && ids && (item[fieldId] !== idMap[item[fieldId]]) && existingItemsMap.hasOwnProperty(fieldId)) {
continue;
}
if (!groupsContent.hasOwnProperty(groupId)) {
Expand Down

0 comments on commit f7d59fc

Please sign in to comment.