Weird behaviour of notification node

I have a weird issue with notification node in "show dialog" mode. It's easy to test with two inject nodes (timestamp and empty string), a "show dialog" with OK/Cancel and a debug node.

If the timestamp is injected for the first time and user picks an option it works as it should.

If the timestamp is injected and dismissed by an empty string the debug shows "OK" being pressed twice in the same second (with no user action).

If timestamp is injected and another one is injected when the dialog is still active the debug shows "Cancel" being pressed twice (with no user action).

When two "show dialog" nodes are present on the flow and used repeatedly (let's say OK/Cancel and Yes/No) sometimes pressing OK gives Yes on the debug etc.

These below are produced with no user interaction with the dashboard, only timestamp and empty string nodes

9.12.2019, 22:16:13node: 9f7ee7ad.3e151msg.payload : string[2]
"OK"
9.12.2019, 22:16:13node: 9f7ee7ad.3e151msg.payload : string[2]
"OK"
9.12.2019, 22:16:19node: 9f7ee7ad.3e151msg.payload : string[6]
"Cancel"
9.12.2019, 22:16:19node: 9f7ee7ad.3e151msg.payload : string[6]
"Cancel"

In this example "OK" was an user action, "Cancel" appeared when another timestamp was injected:

9.12.2019, 22:19:49node: 9f7ee7ad.3e151msg.payload : string[2]
"OK"
9.12.2019, 22:19:56node: 9f7ee7ad.3e151msg.payload : string[6]
"Cancel"

Can you please confirm this behavior as it makes the node pretty much useless in my case?

Hi @Darkdude.

Someone is going to say it, and so I may as well.

You will need to post the flow.

To post the flow, select the nodes and export them to the clipboard.

In here, when ready to post the code, prefix the code with three ` symbols. (Just to the left of the number 1 key)
Paste the code, then put another 3 of them.

That will help a lot for people wanting to read the code and look at it better.

2 Likes

Furthermore, while you’re on it can you confirm the versions and platform you’re using? So node-red version, nodejs version, node-red-dashboard version, the platform/operating system you run on. In the case of a problem, these can be used to both verify the issue, and see if it happens under different circumstances too.

2 Likes

The flow I'm using is this one:

[{"id":"771b18d7.1822d","type":"inject","z":"385e8285.ab43a6","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1390,"y":1030,"wires":[["a0b4e9f0.4f087"]]},{"id":"9f7ee7ad.3e151","type":"debug","z":"385e8285.ab43a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1804,"y":993,"wires":[]},{"id":"af70130d.5beb6","type":"inject","z":"385e8285.ab43a6","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1382,"y":979,"wires":[["a0b4e9f0.4f087"]]},{"id":"a0b4e9f0.4f087","type":"ui_toast","z":"385e8285.ab43a6","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"Cancel","raw":false,"topic":"","name":"","x":1594,"y":995,"wires":[["9f7ee7ad.3e151"]]}]

As for software I run Node Red from a docker container, so it's v1.0.3 of Node Red and v2.19.2 of Dashboard.

There is only one instance of popup. So any new messages will have an effect on existing ones.
If a new one arrives when an existing one is active it will send cancel as in effect that is what has happened - you have to dismiss the first in order to see the second and you can't assume it's an OK as no human has clicked a positive acknowledgment.
The blank sending OK may indeed be a bug as that should send Cancel as well.

Thanks as always, dceejay

Now I understand how the popup works a little better. Still, an empty string always result in "OK" on my setup.

That is currently correct. I will fix it to return Cancel to be more consistent and correct.

Pushed to master branch.