Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] node.target is overwriten on execution #15

Open
MyGg29 opened this issue Apr 6, 2021 · 1 comment
Open

[Bug] node.target is overwriten on execution #15

MyGg29 opened this issue Apr 6, 2021 · 1 comment

Comments

@MyGg29
Copy link

MyGg29 commented Apr 6, 2021

If you create node.target based on something present in msg , the node.target of the click-on node will be overwritten silently and you won't be able to set it again without redeploying.

Example flow
https://pastebin.com/b1iED30M

Now call with postman (or anything)

https://localhost:1880/test

with payloads :
{ "text": "Create a free Team" }
then
{ "text": "Join the community" }

The webdriver won't click on the right bloc on the second execution.

This is because node.target is overwritten by reference there :

node.target = (node.target && node.target != "") ? node.target : msg.target;

Indeed, when you do a node.target = "anything", the change will travel back to the actual node because node is an reference to an object. The change will not be reflected in the node red interface
At the next execution, the ternary will take node.target instead of msg.target because node.target was set at the previous execution silently.

This is a pretty big bug and I'm supprised nobody is complaining about that.

The same bug exists for node.selector, node.timeout, etc

@cuongquay
Copy link
Owner

cuongquay commented Apr 6, 2021

If you create node.target based on something present in msg , the node.target of the click-on node will be overwritten silently and you won't be able to set it again without redeploying.

Example flow
https://pastebin.com/b1iED30M

Now call with postman (or anything)

https://localhost:1880/test

with payloads :
{ "text": "Create a free Team" }
then
{ "text": "Join the community" }

The webdriver won't click on the right bloc on the second execution.

This is because node.target is overwritten by reference there :

node.target = (node.target && node.target != "") ? node.target : msg.target;

Indeed, when you do a node.target = "anything", the change will travel back to the actual node because node is an reference to an object. The change will not be reflected in the node red interface
At the next execution, the ternary will take node.target instead of msg.target because node.target was set at the previous execution silently.

This is a pretty big bug and I'm supprised nobody is complaining about that.

The same bug exists for node.selector, node.timeout, etc

Hi MyGg29. Thank you for your comment. If you are using this node and be able to create a patch for everyone. You are welcome to be a contributor and I would be an honor to do a merge. I haven't used this node for years so there is no maintenance effort in my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants