Fix join node reset issue with merging objects

and add tests
to close #2188
This commit is contained in:
Dave Conway-Jones
2019-06-20 18:14:46 +01:00
parent 8486f4d43a
commit f3fc083330
2 changed files with 9 additions and 2 deletions

View File

@@ -572,6 +572,8 @@ module.exports = function(RED) {
}
}
if (msg.hasOwnProperty("reset")) { if (inflight[partId]) { delete inflight[partId] }; return; }
if ((payloadType === 'object') && (propertyKey === null || propertyKey === undefined || propertyKey === "")) {
if (node.mode === "auto") {
node.warn("Message missing 'msg.parts.key' property - cannot add to object");
@@ -590,7 +592,6 @@ module.exports = function(RED) {
return;
}
if (msg.hasOwnProperty("reset")) { if (inflight[partid]) { delete inflight[partId] } return; }
if (!inflight.hasOwnProperty(partId)) {
if (payloadType === 'object' || payloadType === 'merged') {
inflight[partId] = {
@@ -631,7 +632,7 @@ module.exports = function(RED) {
}
if (payloadType === 'object') {
group.payload[propertyKey] = property;
group.currentCount = (group.currentCount || 0) + 1;
group.currentCount = Object.keys(group.payload).length;
} else if (payloadType === 'merged') {
if (Array.isArray(property) || typeof property !== 'object') {
if (!msg.hasOwnProperty("complete")) {