How to emit with 'widget-send' without updating the node's datastore?

I am developing a custom UI node for dashboard-2 and using the datastore to save the node's data image (for populating the widgets upon page open/refresh). In the datastore I'm using a proprietary data structure (with both data & meta-data), and it all works very well.

I noticed that when I send a message from the widget (in the standard way - using emit('widget-send',...) the message is automatically merged into my data structure in the datastore. This creates a mess (as well as a risk of corrupting my data).

I don't need the messages to be saved. Is there a way to disable this?

I tried to use 'widget-action', which does not affect the datastore, but it introduces another problem: it overrides the existing msg.topic with undefined.
(I looked into the Vue code: the handler expects an event argument with a topic property, which is not there).

OK, I investigated a bit and found the solution:
Setting onAction to false in the server node, disables the default 'widget-action' handler (which overrides msg.topic), and allows me to provide my own handler where I can do whatever I want with the message - tweak it, discard it etc.
RTFM... :person_facepalming:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.