Browse Source

LineGraph: Add an existingItemsMap to check if items are new or not before skipping (#3075)

gemini
Angelo Youn 7 years ago
committed by yotamberk
parent
commit
585d8b092e
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      lib/timeline/component/LineGraph.js

+ 3
- 1
lib/timeline/component/LineGraph.js View File

@ -453,6 +453,7 @@ LineGraph.prototype._updateAllGroupData = function (ids, groupIds) {
} }
//Pre-load arrays from existing groups if items are not changed (not in ids) //Pre-load arrays from existing groups if items are not changed (not in ids)
var existingItemsMap = {};
if (!groupIds && ids) { if (!groupIds && ids) {
for (var groupId in this.groups) { for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) { if (this.groups.hasOwnProperty(groupId)) {
@ -460,6 +461,7 @@ LineGraph.prototype._updateAllGroupData = function (ids, groupIds) {
var existing_items = group.getItems(); var existing_items = group.getItems();
groupsContent[groupId] = existing_items.filter(function (item) { groupsContent[groupId] = existing_items.filter(function (item) {
existingItemsMap[item[fieldId]] = item[fieldId];
return (item[fieldId] !== idMap[item[fieldId]]); return (item[fieldId] !== idMap[item[fieldId]]);
}); });
var newLength = groupCounts[groupId]; var newLength = groupCounts[groupId];
@ -478,7 +480,7 @@ LineGraph.prototype._updateAllGroupData = function (ids, groupIds) {
if (groupId === null || groupId === undefined) { if (groupId === null || groupId === undefined) {
groupId = UNGROUPED; groupId = UNGROUPED;
} }
if (!groupIds && ids && (item[fieldId] !== idMap[item[fieldId]])) {
if (!groupIds && ids && (item[fieldId] !== idMap[item[fieldId]]) && existingItemsMap.hasOwnProperty(item[fieldId])) {
continue; continue;
} }
if (!groupsContent.hasOwnProperty(groupId)) { if (!groupsContent.hasOwnProperty(groupId)) {

Loading…
Cancel
Save