diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js index e44a90dc6..2a6a7af18 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js @@ -846,7 +846,10 @@ }, value: function(value) { var that = this; - var opt = this.typeMap[this.propertyType]; + // If the default type has been set to an invalid type, then on first + // creation, the current propertyType will not exist. Default to an + // empty object on the assumption the corrent type will be set shortly + var opt = this.typeMap[this.propertyType] || {}; if (!arguments.length) { var v = this.input.val(); if (opt.export) { diff --git a/packages/node_modules/@node-red/nodes/core/common/20-inject.html b/packages/node_modules/@node-red/nodes/core/common/20-inject.html index bd17e1635..73dd7fe40 100644 --- a/packages/node_modules/@node-red/nodes/core/common/20-inject.html +++ b/packages/node_modules/@node-red/nodes/core/common/20-inject.html @@ -539,7 +539,7 @@ var propertyValue = $('',{class:"node-input-prop-property-value",type:"text"}) .css("width","calc(70% - 30px)") .appendTo(row) - .typedInput({default:prop.vt,types:['flow','global','str','num','bool','json','bin','date','jsonata','env','msg']}); + .typedInput({default:prop.vt || 'str',types:['flow','global','str','num','bool','json','bin','date','jsonata','env','msg']}); propertyName.typedInput('value',prop.p); propertyValue.typedInput('value',prop.v); @@ -562,7 +562,7 @@ var topic = { p:'topic', v: node.topic ? node.topic : '', - vt:'string' + vt:'str' } node.props = [payload,topic]; } @@ -578,6 +578,11 @@ newProp.v = node.topic ? node.topic : ''; } } + if (newProp.vt === "string") { + // Fix bug in pre 2.1 where an old Inject node might have + // a migrated rule with type 'string' not 'str' + newProp.vt = "str"; + } eList.editableList('addItem',newProp); }