lorenwest / node-red-contrib-state

Node-RED shared logical state with persistence, notification, and history
MIT License
7 stars 6 forks source link

Behavior of setState with provide output #9

Open askarzh opened 2 years ago

askarzh commented 2 years ago

Hi!

I'm not sure but I think that the current behavior of setState with provide output is not so clear. I expect the setState output should be triggered only by the current setState and not the others.

lorenwest commented 2 years ago

Hello,

I cannot understand the problem based on your description. If this is a bug, can you please provide a reproduction scenario?

If it is a clarification of the way the library works, could you suggest the place on the home page to clarify this behavior?

Thank you, -Loren

askarzh commented 2 years ago

In example, we have one state and two setState. First setState provides output. So, if second setState changes the state than first setState is also triggered and provides output to next flow.

lorenwest commented 2 years ago

The design is to have multiple inputs to a single setState node. If you have multiple setState nodes for the same state, the behavior is undefined.

lorenwest commented 2 years ago

See the shared state design diagram to see how the library was intended to be used with multiple nodes setting a single state.

askarzh commented 2 years ago

Got it. Actually, it works very well with multiple setState. Only provide output behavior is not clear.