# Contrib-config Causing issue with 1.0

**URL:** <https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176>\
**Category:** General\
**Created:** [1 October 2019 23:48 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176 "2019-10-01T23:48:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanrdetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryanrdetzel/32/5286_2.png) [@ryanrdetzel](https://discourse.nodered.org/u/ryanrdetzel)\
**Post date:** [1 October 2019 23:48 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/1 "2019-10-01T23:48:55Z")

</div>

Other people have complained about this since 1.0 beta. Here is the console error which doesn't make much sense.

```auto
red.min.js:16 Uncaught TypeError: Cannot read property 'icon' of undefined
    at t.<computed>.<computed>._updateOptionSelectLabel (red.min.js:16)
    at t.<computed>.<computed>._updateOptionSelectLabel (vendor.js:formatted:4691)
    at t.<computed>.<computed>.value (red.min.js:16)
    at t.<computed>.<computed>.value (vendor.js:formatted:4691)
    at HTMLInputElement.<anonymous> (vendor.js:formatted:4734)
    at Function.each (vendor.js:formatted:146)
    at e.fn.init.each (vendor.js:formatted:74)
    at e.fn.init.t.fn.<computed> [as typedInput] (vendor.js:formatted:4731)
    at Object.addItem (<anonymous>:48:34)
    at red.min.js:16

```

I tracked it down to this code block but it's this single line that causes the issue

```auto
 propertyName.typedInput('value', property.p);

```

With the type as flow or global the value can not be set. Any ideas on what to try? I change this to a str instead and I don't get any more errors but the code obviously doesn't work.

```auto
$('#node-input-config-container').css('min-height','300px').css('min-width','450px').editableList({
                addItem: function(container,i,property) {
                    if (!property.hasOwnProperty('p')) {
                        property = {p:"",pt:"flow",to:"",tot:"str"};
                    }

                    var row1 = $('<div/>').appendTo(container);
                    var row2 = $('<div/>',{style:"margin-top:8px;"}).appendTo(container);

                    $('<label/>',{for:"node-input-config-property-name",style:"width:110px; margin-right:10px;"}).text("Property").appendTo(row1);

                    var propertyName = $('<input/>',{style:"width:250px",class:"node-input-config-property-name",type:"text"})
                        .appendTo(row1)
                        .typedInput({types:['flow','global']}).focus();

                    $('<label/>',{for:"node-input-config-property-value",style:"width:110px; margin-right:10px;"}).text("Value").appendTo(row2);
                    var propertyValue = $('<input/>',{style:"width:250px",class:"node-input-config-property-value",type:"text"})
                        .appendTo(row2)
                        .typedInput({types:['str','num','bool','json','date']});

                    propertyName.typedInput('type', property.pt);
                    propertyName.typedInput('value', property.p);
                    propertyValue.typedInput('value',property.to);
                    propertyValue.typedInput('type',property.tot);
                    var newWidth = $("#node-input-config-container").width();
                    resizeConfig(container);
                },
                resizeItem: resizeConfig,
                removable: true,
                sortable: false
            });

```

The module is node-red-contrib-config

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [1 October 2019 23:56 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/2 "2019-10-01T23:56:13Z")

</div>

The contrib node needs fixing, have you opened an issue on the nodes github page?

---

<div class="post-metadata">

**Author:** ![ryanrdetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryanrdetzel/32/5286_2.png) [@ryanrdetzel](https://discourse.nodered.org/u/ryanrdetzel)\
**Post date:** [1 October 2019 23:57 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/3 "2019-10-01T23:57:48Z")

</div>

There is one, [https://github.com/DeanCording/node-red-contrib-config/issues/4](https://github.com/DeanCording/node-red-contrib-config/issues/4), but that hasn't been touched in over two years so I'm not holding my breath. I don't mind fixing it but I have no idea why that's not working, it seems like a nodered issue to me.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 October 2019 00:00 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/4 "2019-10-02T00:00:31Z")

</div>

Ahhh see [Where Did I Go?](https://discourse.nodered.org/t/where-did-i-go/16175)

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 October 2019 00:04 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/5 "2019-10-02T00:04:23Z")

</div>

and [https://nodered.org/blog/2019/09/30/version-1-0-released#editor-css-restructuring](https://nodered.org/blog/2019/09/30/version-1-0-released#editor-css-restructuring)

---

<div class="post-metadata">

**Author:** ![ryanrdetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryanrdetzel/32/5286_2.png) [@ryanrdetzel](https://discourse.nodered.org/u/ryanrdetzel)\
**Post date:** [2 October 2019 10:43 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/6 "2019-10-02T10:43:22Z")

</div>

Thanks, I'm not sure this is related to any css changes, it seems like it's a JS issue when trying to set the value on the typedinput.

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [2 October 2019 11:30 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/7 "2019-10-02T11:30:07Z")

</div>

If this issue is specific to contrib node `contrib-config` then it would be good to change the title of the post to make easier for people to understand it and not open similar posts in the future.

---

<div class="post-metadata">

**Author:** ![ryanrdetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryanrdetzel/32/5286_2.png) [@ryanrdetzel](https://discourse.nodered.org/u/ryanrdetzel)\
**Post date:** [2 October 2019 12:51 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/8 "2019-10-02T12:51:25Z")

</div>

I'm stumped. It only breaks with the type for that input is global/flow. I can change it to anything else, msg, str, etc and I don't get that error and things work.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 October 2019 15:15 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/9 "2019-10-02T15:15:47Z")

</div>

JFI - I tried this node out to see if I could help find the error but I have a different issue with it

I set flow.ctest to foo in one node and made that the active one  
I then set flow.ctest to bar in another copy and made that not active

pressing the buttons alternatively switched flow.ctest between foo and bar

Redeploying flow reset flow.ctest to foo  
Stop and starting Node-RED itself reset flow.ctest to foo

So it worked fine for me......but ....

the value (foor or bar) is blank when I re-edit either of them

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/73cda00def332c1b89e0b79739d7be74e2b868de.png)

---

<div class="post-metadata">

**Author:** ![ryanrdetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryanrdetzel/32/5286_2.png) [@ryanrdetzel](https://discourse.nodered.org/u/ryanrdetzel)\
**Post date:** [2 October 2019 17:27 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/10 "2019-10-02T17:27:58Z")

</div>

Do you get errors in your javascript console?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 October 2019 17:33 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/11 "2019-10-02T17:33:58Z")

</div>

I get errors but I've no idea where they are coming from (I'm no expert on the console - I only use it if someone tell me to look at it)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/9f174bf22837d754cc45eae141cf4c73f46afe48.png)

---

<div class="post-metadata">

**Author:** ![ryanrdetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryanrdetzel/32/5286_2.png) [@ryanrdetzel](https://discourse.nodered.org/u/ryanrdetzel)\
**Post date:** [2 October 2019 17:44 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/12 "2019-10-02T17:44:45Z")

</div>

So you're seeing the same error as me, it's related.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [3 October 2019 09:11 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/13 "2019-10-03T09:11:52Z")

</div>

Well - just spent 2 hours playing with this and for life of me, I don't know why it doesn't behave properly on 1.0.0 ☹  
However, I have found a workaround - although it still gives the error in the console - it displays the previous saved values so if you ignore the console error - you can carry on using it 🙂

The bodge fix is to swap the lines around in config.html  
from

```auto
                    propertyName.typedInput('value',property.p);
                    propertyName.typedInput('type',property.pt);
                    propertyValue.typedInput('value',property.to);
                    propertyValue.typedInput('type',property.tot);

```

to

```auto
                    propertyValue.typedInput('value',property.to);
                    propertyValue.typedInput('type',property.tot);
                    propertyName.typedInput('value',property.p);
                    propertyName.typedInput('type',property.pt);

```

please give it a a try and see if it works for you

---

<div class="post-metadata">

**Author:** ![tilleul](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tilleul/32/78_2.png) [@tilleul](https://discourse.nodered.org/u/tilleul)\
**Post date:** [3 October 2019 13:18 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/14 "2019-10-03T13:18:26Z")

</div>

I have the exact same error with a node of mine.  
Here's an excerpt of the code I used:

```auto
field = $('<input/>',style)
           .appendTo(srow)
           .typedInput({default:'bool',types:['str','num','bool']});
field.typedInput("type", rule.value1Type || 'bool');
field.typedInput("value", rule.value1);

```

(this `typedInput` is used with a multi-rules widget like the one in the switch/change nodes)  
It turns out that `rule.value1` equals `true` by default (for a new rule) and that `typedInput` in NR 1.0 does not like that !

If I replace the last line with

```auto
field.typedInput("value", rule.value1.toString());

```

then it doesn't throw the error but on the other side, my field is now a string a not a boolean !  
@knolleary is there any change in NR 1.0 in the behavior of typedInput ? Maybe I overlooked the info somewhere ? Thanks.

---

<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:** [3 October 2019 13:19 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/15 "2019-10-03T13:19:47Z")

</div>

There have been some internal changes to typedInput, but nothing that was intended to break this sort of usage.  
Will investigate.

---

<div class="post-metadata">

**Author:** ![tilleul](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tilleul/32/78_2.png) [@tilleul](https://discourse.nodered.org/u/tilleul)\
**Post date:** [3 October 2019 13:22 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/16 "2019-10-03T13:22:29Z")

</div>

Thanks. To be fair, it seems that it doesn't really matter if my field is a string as it seems (and I should investigate further) that it was the way it worked in NR before v1.0 (inspecting flows.json I see these fields are string with "boolean" values)... the only thing that clearly changed is the fact that NR doesn't like a bool when using `value` .

---

<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:** [3 October 2019 14:06 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/17 "2019-10-03T14:06:27Z")

</div>

Have pushed a fix. We'll have 1.0.1 out today/tomorrow with it in.

I did also check the behaviour in 0.20 and whilst it doesn't throw the error, nor does it do quite what you expect.

If the type has been set to `"bool"` and you pass it the value `true` or `false` (ie Boolean types, not Strings), then it doesn't set the value of the typedInput to the corresponding value. This is because it is expecting the values to be `"true"` or `"false"` and it does a strict comparison. I've relaxed that a bit so if the options available in the node are strings and you pass in a non-String, we'll toString it before comparing.

---

<div class="post-metadata">

**Author:** ![ryanrdetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryanrdetzel/32/5286_2.png) [@ryanrdetzel](https://discourse.nodered.org/u/ryanrdetzel)\
**Post date:** [3 October 2019 14:07 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/18 "2019-10-03T14:07:43Z")

</div>

Will this fix the issue we were seeing with the contrib-config node too?

---

<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:** [3 October 2019 14:09 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/19 "2019-10-03T14:09:10Z")

</div>

I haven't checked it explicitly, but its the same error in the log, so I would expect so.

---

<div class="post-metadata">

**Author:** ![tilleul](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tilleul/32/78_2.png) [@tilleul](https://discourse.nodered.org/u/tilleul)\
**Post date:** [3 October 2019 15:35 UTC](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176/20 "2019-10-03T15:35:24Z")

</div>

Great ! Thanks !

[Next page](https://discourse.nodered.org/t/contrib-config-causing-issue-with-1-0/16176.md?page=2)
