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

The Dropdown node (and possibly others) does not discard previous messages sent to it when a new message is sent

Open colinl opened this issue 9 months ago • 2 comments

Current Behavior

If a message containing, for example, msg.foo, is sent to the dropdown node and then the user makes a selection in the dropdown, the message sent correctly includes msg.foo. However, if another message is sent that does not contain msg.foo and then the user makes a selection then the passed on message still includes the msg.foo from the previous message.

In addition to being incorrect behaviour this will lead to a memory leak if previous prpperties are not being discarded.

Expected Behavior

When a new message is sent to the node, any previous properties (except msg.ui_update) should be discarded.

Steps To Reproduce

This flow shows the problem.

[{"id":"f09c46569223d57e","type":"ui-dropdown","z":"997da33a0beedade","group":"172831d51c603731","name":"","label":"Select Option:","tooltip":"","order":0,"width":0,"height":0,"passthru":false,"multiple":false,"chips":false,"clearable":false,"options":[{"label":"1","value":"1","type":"str"},{"label":"2","value":"2","type":"str"},{"label":"3","value":"3","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","typeIsComboBox":true,"msgTrigger":"onChange","x":400,"y":7280,"wires":[["6a9a79924973c09f"]]},{"id":"6a9a79924973c09f","type":"debug","z":"997da33a0beedade","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":7280,"wires":[]},{"id":"8114e4a8cfe6dfae","type":"inject","z":"997da33a0beedade","name":"msg.foo: timestamp","props":[{"p":"foo","v":"","vt":"date"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":170,"y":7280,"wires":[["f09c46569223d57e"]]},{"id":"cf9a200673d354a1","type":"comment","z":"997da33a0beedade","name":"1. inject msg.foo once","info":"","x":140,"y":7220,"wires":[]},{"id":"d615babf82ded536","type":"comment","z":"997da33a0beedade","name":"2. make a selection in the dashboard","info":"","x":470,"y":7220,"wires":[]},{"id":"62f7f56f5d871e93","type":"comment","z":"997da33a0beedade","name":"3. the output should contain msg.foo","info":"","x":850,"y":7220,"wires":[]},{"id":"3b4e04d390e1f090","type":"comment","z":"997da33a0beedade","name":"4. inject msg without msg.foo","info":"","x":140,"y":7340,"wires":[]},{"id":"6cb0aa7675bfbefb","type":"inject","z":"997da33a0beedade","name":"No msg.foo","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":150,"y":7400,"wires":[["f09c46569223d57e"]]},{"id":"984a6d39058f5ab1","type":"comment","z":"997da33a0beedade","name":"5. make a selection in the dashboard","info":"","x":460,"y":7340,"wires":[]},{"id":"012f5f759a8ca925","type":"comment","z":"997da33a0beedade","name":"6. the output should not contain msg.foo","info":"","x":850,"y":7340,"wires":[]},{"id":"172831d51c603731","type":"ui-group","name":"Shortcuts","page":"1b03ed82bc9475f7","width":"2","height":1,"order":1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"1b03ed82bc9475f7","type":"ui-page","name":"Page 1","ui":"ID-BASE-1","path":"/page1","icon":"home","layout":"grid","theme":"eb073b1928676e1f","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"order":1,"className":"","visible":"true","disabled":"false"},{"id":"ID-BASE-1","type":"ui-base","name":"Dashboard","path":"/dashboard","includeClientData":true,"acceptsClientConfig":["ui-control","ui-notification","ui-gauge-classic"],"titleBarStyle":"default"},{"id":"eb073b1928676e1f","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094CE","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"density":"default","pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}}]

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 have provided an initial effort estimate

colinl avatar Apr 06 '25 07:04 colinl

Confirmed this is what happens.

Steve-Mcl avatar Apr 08 '25 16:04 Steve-Mcl

This was introduced in https://github.com/FlowFuse/node-red-dashboard/pull/1465 in commit 44dfae8b891e16e8fc523d9d748383a86a4a3eb1

Hopefully @joepavitt can make a judgement call on if this can/should be rolled back.

Steve-Mcl avatar Apr 08 '25 17:04 Steve-Mcl