From 585d8b092e1b72633a7a89fc002d8e195a58209a Mon Sep 17 00:00:00 2001 From: Angelo Youn Date: Sat, 20 May 2017 09:58:00 -0700 Subject: [PATCH] LineGraph: Add an existingItemsMap to check if items are new or not before skipping (#3075) --- lib/timeline/component/LineGraph.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/timeline/component/LineGraph.js b/lib/timeline/component/LineGraph.js index ec797541..f0287bc9 100644 --- a/lib/timeline/component/LineGraph.js +++ b/lib/timeline/component/LineGraph.js @@ -453,6 +453,7 @@ 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)) { @@ -460,6 +461,7 @@ LineGraph.prototype._updateAllGroupData = function (ids, groupIds) { var existing_items = group.getItems(); groupsContent[groupId] = existing_items.filter(function (item) { + existingItemsMap[item[fieldId]] = item[fieldId]; return (item[fieldId] !== idMap[item[fieldId]]); }); var newLength = groupCounts[groupId]; @@ -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(item[fieldId])) { continue; } if (!groupsContent.hasOwnProperty(groupId)) {