typeField problems in 2.1.3

I have been using the behavior described below for my contrib node to define typeField as a list of options including one which is 'undefined': GitHub - dxdc/node-red-contrib-join-wait: Node-RED module to wait for incoming messages from different input paths to arrive within a fixed time window..

As of v2, something changed and now correlationTopic is not persisted in the editor window (though, it is persisted properly if I export the node JSON, and the node also functions properly).

So, if I create a new node, and set correlationTopic to something like msg.xyz, it will show properly in the exported JSON, but just not in the editor window after saving the changes.

It has something to do with the undefined option. If I remove hasValue: false for instance, while the behavior of undefined then becomes undesired, it will show the correlationTopic. This seems like a bug in the core somewhere, but not sure if there is an issue with the typeField definition. This used to work properly in NR 1.3.x.

                default: this.correlationTopicType || types.Undefined,
                typeField: $('#node-input-correlationTopicType'),
                types: [
                    { value: 'undefined', label: RED._('common.type.undefined'), hasValue: false },

Hi @dxdc

You have found a bug. I have a fix and we'll publish it in 2.1.4 later this week.

The workaround from your side would be to not have your undefined rule as the first in the type list.

I've also noticed you have types.Undefined in your code - but I don't see types being defined anywhere in the node. But as this.correlationTopicType will always be defined, it is never being exercised, so won't show up as an error.

Thanks for the lightning response @knolleary! I'll modify this line then per your suggestion:

default: this.correlationTopicType || 'undefined'

Does that look better? The documentation on writing editor controls is not very thorough, so I pieced my code together after reviewing a lot of existing contrib and core modules.

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