mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Filter out duplicate nodes when importing a flow
This commit is contained in:
parent
afe89c3621
commit
8aa00b0cfc
@ -766,6 +766,20 @@ RED.nodes = (function() {
|
|||||||
if (!$.isArray(newNodes)) {
|
if (!$.isArray(newNodes)) {
|
||||||
newNodes = [newNodes];
|
newNodes = [newNodes];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scan for any duplicate nodes and remove them. This is a temporary
|
||||||
|
// fix to help resolve corrupted flows caused by 0.20.0 where multiple
|
||||||
|
// copies of the flow would get loaded at the same time.
|
||||||
|
// If the user hit deploy they would have saved those duplicates.
|
||||||
|
var seenIds = {};
|
||||||
|
newNodes = newNodes.filter(function(n) {
|
||||||
|
if (seenIds[n.id]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
seenIds[n.id] = true;
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
|
||||||
var isInitialLoad = false;
|
var isInitialLoad = false;
|
||||||
if (!initialLoad) {
|
if (!initialLoad) {
|
||||||
isInitialLoad = true;
|
isInitialLoad = true;
|
||||||
|
@ -34,7 +34,6 @@ var RED = (function() {
|
|||||||
var srcUrl = $(el).attr('src');
|
var srcUrl = $(el).attr('src');
|
||||||
if (srcUrl && !/^\s*(https?:|\/|\.)/.test(srcUrl)) {
|
if (srcUrl && !/^\s*(https?:|\/|\.)/.test(srcUrl)) {
|
||||||
$(el).remove();
|
$(el).remove();
|
||||||
console.log("Appending script for",moduleId)
|
|
||||||
var newScript = document.createElement("script");
|
var newScript = document.createElement("script");
|
||||||
newScript.onload = function() {
|
newScript.onload = function() {
|
||||||
scriptCount--;
|
scriptCount--;
|
||||||
|
Loading…
Reference in New Issue
Block a user