# typeField problems in 2.1.3

**URL:** <https://discourse.nodered.org/t/typefield-problems-in-2-1-3/53832>\
**Category:** General\
**Created:** [16 November 2021 13:50 UTC](https://discourse.nodered.org/t/typefield-problems-in-2-1-3/53832 "2021-11-16T13:50:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dxdc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dxdc/32/23114_2.png) [@dxdc](https://discourse.nodered.org/u/dxdc)\
**Post date:** [16 November 2021 13:50 UTC](https://discourse.nodered.org/t/typefield-problems-in-2-1-3/53832/1 "2021-11-16T13:50:26Z")

</div>

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.](https://github.com/dxdc/node-red-contrib-join-wait).

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.

```auto
            $('#node-input-correlationTopic').typedInput({
                default: this.correlationTopicType || types.Undefined,
                typeField: $('#node-input-correlationTopicType'),
                types: [
                    { value: 'undefined', label: RED._('common.type.undefined'), hasValue: false },
                    'msg',
                    'flow',
                    'global',
                    'jsonata',
                ],
            });

```

 ![Screen Shot 2021-11-16 at 7.51.00 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/8/08da7cc57427a0fcfa9cf1e790c15ec1afc94dda.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [16 November 2021 14:23 UTC](https://discourse.nodered.org/t/typefield-problems-in-2-1-3/53832/2 "2021-11-16T14:23:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dxdc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dxdc/32/23114_2.png) [@dxdc](https://discourse.nodered.org/u/dxdc)\
**Post date:** [16 November 2021 14:38 UTC](https://discourse.nodered.org/t/typefield-problems-in-2-1-3/53832/3 "2021-11-16T14:38:30Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 January 2022 14:39 UTC](https://discourse.nodered.org/t/typefield-problems-in-2-1-3/53832/4 "2022-01-15T14:39:28Z")

</div>

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