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

‘widget-action’ messages set msg.topic to ‘undefined’

Open omrid01 opened this issue 8 months ago • 0 comments

Current Behavior

I have upgraded my dashboard-2 to v1.23.0.

In my custom UI node, when I send messages as 'widget-action' (this.$socket.emit('widget-action', this.id, msg)), their topic property is getting overrun and becomes undefined.

This happens also in the generic ui-template node. Using this.send(msg) works OK, but using emit to 'widget-action' overwrites the topic property. For example, injecting a msg with msg.topic='myTopic' to the template:

mounted() {
	const $scope = this;

	// Socket listener
	this.$socket.on('msg-input:' + this.id, function(msg) {

		msg.payload = "Using 'emit'";
		$scope.$socket.emit('widget-action', $scope.id, msg);

		msg.payload = "Using 'send'";
		$scope.send(msg)
	});
}

returns the following result: Image This was not happening on previous dashboard versions.

Expected Behavior

msg.topic should not be overwritten

Steps To Reproduce

set a msg.topic value, and emit a message to 'widget-action' using $socket.emit('widget-action', this.id, msg)

Environment

  • Dashboard version: 1.23.0
  • Node-RED version: 4.09
  • Node.js version: 22.14.0
  • npm version: 11.1.0
  • Platform/OS: Windows
  • Browser: Edge

Have you provided an initial effort estimate for this issue?

I can not provide an initial effort estimate

omrid01 avatar Apr 23 '25 10:04 omrid01