node-red-dashboard icon indicating copy to clipboard operation
node-red-dashboard copied to clipboard

Should widgets forward any properties received in messages

Open arturv2000 opened this issue 1 year ago • 2 comments

Current Behavior

Currently, depending on the widget, in case the widget received a message with any property that property also appears on the widget output upon dashboard action (for example ui-button and ui-textInput replay the last message changing only the payload, while ui-form creates a new message only containing the payload). For example, if I send a message msg.test = 123 to a button, in the next button click the message from the button will have msg.test = 123 included, in the case of the button this do not survive a page refresh or switching visible tabs.

This behaviour should be standardized, from what i can see in old DB1 the widgets did not store the incoming message to replay on output (only tested with button and textInput).

The behaviour of storing these properties (messages) to forward can be useful when wanting to use this to send other variables to other nodes without the need to use context store in node-red, but this causes some issues, especially with the "reserved properties" used to control the widgets, like enabled, class, visible and ui_update. These properties at least should be stripped of messages that the widget send, otherwise we may change another widget down the line by a setting we sent to another widget if the user never creates a new msg object or if it is directly connected to another dashboard widget.

For consistency (and even to reduce websocket / message overhead) would say that the behaviour DB1 has should be standardized across the widgets, the widget should only send msg.payload as well the other required properties (msg._msgid, msg.topic, msg._client and other deemed necessary for the management of the widgets / messages in Node-Red). If the widget is in passthrough mode in that scenario the output message should be the same as input when receiving a new input message, but in case of action (click) should only send the msg.payload.

Expected Behavior

Widgets upon action should only send the relevant properties in most cases only msg.payload and msg.topic.

Steps To Reproduce

No response

Environment

  • Dashboard version:
  • Node-RED version:
  • Node.js version:
  • npm version:
  • Platform/OS:
  • Browser:

Have you provided an initial effort estimate for this issue?

I am not a FlowFuse team member

arturv2000 avatar Jul 25 '24 20:07 arturv2000

I think there has been a previous report of this, #1041

colinl avatar Jul 25 '24 20:07 colinl

Yes. At the Moment I have this issue: I init a Switch wit a Message with an additional property ".init" and this is immediatly been sent so: as expected. But when Afterwards the Switch ist pressed, the init property ist again outputed, this is Not expected and , from my Perspektive, wrong.

m-schaeffler avatar Aug 03 '24 13:08 m-schaeffler