Skip to content

Commit

Permalink
Property write node still sending empty value
Browse files Browse the repository at this point in the history
  • Loading branch information
bautisflow committed Apr 12, 2024
1 parent b800b97 commit dfb362f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
### Fixed

- msg placeholders rendering failed when value is null or undefined
- property write node still sending emtpy payload

## [1.7.2] - 2024-04-11

Expand Down Expand Up @@ -299,6 +300,7 @@ All notable changes to this project will be documented in this file.

## [0.0.6] - 2019-06-20

[1.7.3]: https://github.com/thinger-io/Node-RED/compare/1.7.2...1.7.3
[1.7.2]: https://github.com/thinger-io/Node-RED/compare/1.7.1...1.7.2
[1.7.1]: https://github.com/thinger-io/Node-RED/compare/1.7.0...1.7.1
[1.7.0]: https://github.com/thinger-io/Node-RED/compare/1.6.3...1.7.0
Expand Down
6 changes: 4 additions & 2 deletions nodes/property-write.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@
asset.getProperties().then(function(data) {
ThingerDOM.showOptions("property",data,property);
$("#node-input-property").change(function() {
let propertyValue = JSON.stringify(asset.getPropertyValue($(this).val()),null,'\t');
if ( propertyValue !== null )
let propertyValue = asset.getPropertyValue($(this).val());
if ( propertyValue !== null ) {
propertyValue = JSON.stringify(propertyValue,null,'\t');
editor.setValue(propertyValue);
}
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion nodes/property-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = function(RED) {
}
}

if (typeof data === 'undefined' || (typeof data !== 'object' && data.length === 0))
if (typeof data === 'undefined' || data === null || (typeof data !== 'object' && data.length === 0))
throw new Error("Property value cannot be empty");

data = {property: property, value: (typeof data === 'object') ? data : JSON.parse(data)};
Expand Down

0 comments on commit dfb362f

Please sign in to comment.