# Possible bug ( UI dashboard switch node or function switch Node)

**URL:** https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043
**Category:** General
**Tags:** node-red-dashboard, function-node
**Created:** [9 February 2022 18:01 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043 "2022-02-09T18:01:39Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![vikingsraven](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikingsraven/32/49243_2.png) [@vikingsraven](https://discourse.nodered.org/u/vikingsraven)
#### Post date: [9 February 2022 18:01 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/1 "2022-02-09T18:01:39Z")

</div>

Hi all,  
doing a fairly simple display control for a PTZ camera, anyway i was getting multiple instances of switch toggles, so i copied the offending items to another flow just to see what was happening.  
i added another switch to the same switch node that i was already using and it worked fine , but if i clicked the original one i got double switching e.g true true.  
So i tried to delete the link between the old switch ui and the switch node and it highlighted orange, pressed delete and it was still there!  
re deployed and it still switched, tried to delete the link and this time it went.  
so it looks like there are 2 links connecting to the switch node. tried it a few time just to see if it was me but it did the same thing!  
Node Red 2.2.0  
NPM 6.14.16  
Node 14.19.0  
Linux Mint  
offending item is below

```auto
[
    {
        "id": "722804950b4b4251",
        "type": "switch",
        "z": "77f64d9d09139432",
        "name": "Mode",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 730,
        "y": 220,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "e6f5d2c9e6d468c2",
        "type": "debug",
        "z": "77f64d9d09139432",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 710,
        "y": 180,
        "wires": []
    },
    {
        "id": "aad3e59254f825af",
        "type": "ui_switch",
        "z": "77f64d9d09139432",
        "name": "",
        "label": "Thermo Enable",
        "tooltip": "",
        "group": "e95113d77e51b515",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "fa-power-off fa-2x",
        "oncolor": "green",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "fa-power-off fa-2x",
        "offcolor": "grey",
        "animate": true,
        "className": "",
        "x": 420,
        "y": 220,
        "wires": [
            [
                "722804950b4b4251",
                "722804950b4b4251",
                "e6f5d2c9e6d468c2"
            ]
        ]
    },
    {
        "id": "e95113d77e51b515",
        "type": "ui_group",
        "name": "Thermal Mode",
        "tab": "2bf55b350517e8d4",
        "order": 2,
        "disp": true,
        "width": 6,
        "collapse": false,
        "className": ""
    },
    {
        "id": "2bf55b350517e8d4",
        "type": "ui_tab",
        "name": "PTZ",
        "icon": "camera",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [10 February 2022 00:11 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/2 "2022-02-10T00:11:29Z")

</div>

I can't edit your posts, but you didn't post the code correctly.

You need to use the button that looks like this: `</>` to paste code.  
Otherwise it doesn't work properly.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [10 February 2022 07:18 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/3 "2022-02-10T07:18:21Z")

</div>

You need to select the nodes you want to share and use the menu export command to export to clipboard and paste it here.

---

<div class="post-metadata">

### Author: ![vikingsraven](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikingsraven/32/49243_2.png) [@vikingsraven](https://discourse.nodered.org/u/vikingsraven)
#### Post date: [10 February 2022 08:30 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/4 "2022-02-10T08:30:04Z")

</div>

ok updated previous post

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [10 February 2022 09:26 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/5 "2022-02-10T09:26:16Z")

</div>

I have imported your flow, can you describe what I have to do to see the problem?

**[Edit]** Oh yes, I see what you mean. Deleting the wire between the ui switch and the Switch nodes leaves the wire there the first time, and then you can't select it again.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [10 February 2022 09:36 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/6 "2022-02-10T09:36:13Z")

</div>

Looking at the exported flow, there _are_ two wires from the ui switch to the Switch. How the system could get into this state I don't know, and what is the best way to get out of it I don't know. Perhaps delete those nodes and recreate them.

I think this may need someone like @knolleary to look at it.

---

<div class="post-metadata">

### Author: ![vikingsraven](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikingsraven/32/49243_2.png) [@vikingsraven](https://discourse.nodered.org/u/vikingsraven)
#### Post date: [10 February 2022 11:38 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/7 "2022-02-10T11:38:29Z")

</div>

@Colin Yeah that's the problem, if you delete the first one the second one isn't select able until you refresh the screen then you can delete it.  
i couldn't directly reproduce it after, had to copy that one over.  
Phew thought it was just me lol.

---

<div class="post-metadata">

### Author: ![vikingsraven](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikingsraven/32/49243_2.png) [@vikingsraven](https://discourse.nodered.org/u/vikingsraven)
#### Post date: [10 February 2022 11:53 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/8 "2022-02-10T11:53:29Z")

</div>

if you look at the json data i posted it actually shows up a duplicate wire name

> [@vikingsraven](#):
>
> ```auto
> "wires": [
> [
> "722804950b4b4251",
> "722804950b4b4251",
> "e6f5d2c9e6d468c2"
> ]
> 
> ```

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [10 February 2022 12:15 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/9 "2022-02-10T12:15:31Z")

</div>

> [@vikingsraven](#):
>
> shows up a duplicate wire name

Yes, I said that.

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [10 February 2022 12:59 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/10 "2022-02-10T12:59:12Z")

</div>

I could not understand the issue for quite sometime,

There appears to be only one connection between UI Switch and Switch Node,  
but when you introduce another node in between, there appears another '_hidden_' wire, which you cannot 'select' but disappears when ui switch node is deleted.

![wire](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/3/3342796b998702fa4e1bf23f164ce252ec997bc4.gif)

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [10 February 2022 13:05 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/11 "2022-02-10T13:05:06Z")

</div>

Infact, there seems to be infinite wires hidden there 😲  
 ![wire1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8b92eef9855b09e070407d944e39f3b371edcb7b.gif)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [10 February 2022 14:24 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/12 "2022-02-10T14:24:34Z")

</div>

There are only two, as you saw from the export, but I guess the software is confused by that illegal condition.  
Have you any idea how you got to that state?

---

<div class="post-metadata">

### Author: ![vikingsraven](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vikingsraven/32/49243_2.png) [@vikingsraven](https://discourse.nodered.org/u/vikingsraven)
#### Post date: [10 February 2022 19:59 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/13 "2022-02-10T19:59:54Z")

</div>

@Colin. No idea just dropped a ui switch and a switch node then linked them. Had me chasing my tail for hours. Didn't drag anything in between at any point.  
Done a few more tests and can't reproduce it again.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 February 2022 07:42 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/14 "2022-02-11T07:42:39Z")

</div>

For the record, what browser are you using?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 February 2022 10:35 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/15 "2022-02-11T10:35:16Z")

</div>

@vikingsraven there has been another reported case which looks similar to yours

> [@Msg duplication because of 'Link out' and 'Link in'](https://discourse.nodered.org/t/msg-duplication-because-of-link-out-and-link-in/58127):
>
> Gents, I spent a couple of hour on an unbelievable beharior. I use to introduce many Link out and link in nodes between flows, and even in a single flow for clarifying my flow chart view. My trouble is that, some couple of link out and link in nodes duplicate the messages. This does not occure over all Link nodes, but those ones that give such a behavior run this issue all the time. When I just click on one of them, I clearly see a single discontinuous line between them. When I open hte lin…

I have submitted an issue on github so the developers will see it. Could you subscribe that the issue so you can answer any questions the developers may have, please?

> <https://github.com/node-red/node-red/issues/3433>
>
> \### Current Behavior
> 
> There have been two cases reported on the forum where node…s have been dropped onto the flow and two messages have been received at the output for each one on the input. Looking at the exported flow it can be seen that there are two wires between the two nodes.
> 
> https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043
> https://discourse.nodered.org/t/msg-duplication-because-of-link-out-and-link-in/58127
> 
> The example flow below is from the former post, where it can be seen that there are two identical wires with the ui\_switch node.
> 
> When an attempt is made to delete the duplicated wire the first one deletes, but then the second one refuses to be selected. This is possibly just a side effect of having the duplicated wire.
> 
> 
> \### Expected Behavior
> 
> \_No response\_
> 
> \### Steps To Reproduce
> 
> It has not been possible to reproduce consistently, apparently.
> 
> \### Example flow
> 
> 
> \`\`\`
> \[
> {
> "id": "722804950b4b4251",
> "type": "switch",
> "z": "77f64d9d09139432",
> "name": "Mode",
> "property": "payload",
> "propertyType": "msg",
> "rules": \[
> {
> "t": "true"
> },
> {
> "t": "false"
> }
> \],
> "checkall": "true",
> "repair": false,
> "outputs": 2,
> "x": 730,
> "y": 220,
> "wires": \[
> \[\],
> \[\]
> \]
> },
> {
> "id": "e6f5d2c9e6d468c2",
> "type": "debug",
> "z": "77f64d9d09139432",
> "name": "",
> "active": true,
> "tosidebar": true,
> "console": false,
> "tostatus": false,
> "complete": "false",
> "statusVal": "",
> "statusType": "auto",
> "x": 710,
> "y": 180,
> "wires": \[\]
> },
> {
> "id": "aad3e59254f825af",
> "type": "ui\_switch",
> "z": "77f64d9d09139432",
> "name": "",
> "label": "Thermo Enable",
> "tooltip": "",
> "group": "e95113d77e51b515",
> "order": 1,
> "width": 0,
> "height": 0,
> "passthru": true,
> "decouple": "false",
> "topic": "topic",
> "topicType": "msg",
> "style": "",
> "onvalue": "true",
> "onvalueType": "bool",
> "onicon": "fa-power-off fa-2x",
> "oncolor": "green",
> "offvalue": "false",
> "offvalueType": "bool",
> "officon": "fa-power-off fa-2x",
> "offcolor": "grey",
> "animate": true,
> "className": "",
> "x": 420,
> "y": 220,
> "wires": \[
> \[
> "722804950b4b4251",
> "722804950b4b4251",
> "e6f5d2c9e6d468c2"
> \]
> \]
> },
> {
> "id": "e95113d77e51b515",
> "type": "ui\_group",
> "name": "Thermal Mode",
> "tab": "2bf55b350517e8d4",
> "order": 2,
> "disp": true,
> "width": 6,
> "collapse": false,
> "className": ""
> },
> {
> "id": "2bf55b350517e8d4",
> "type": "ui\_tab",
> "name": "PTZ",
> "icon": "camera",
> "order": 1,
> "disabled": false,
> "hidden": false
> }
> \]
> \`\`\`
> 
> \`\`\`
> 
> 
> \### Environment
> 
> These are from the first forum post, the details from the second are not yet known (apart from being nr 2.2.0)
> \- Node-RED version: 2.2.0
> \- Node.js version: 14.19.0
> \- npm version: 6.14.16
> \- Platform/OS: Linux Mint
> \- Browser: ?

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [11 February 2022 10:37 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/16 "2022-02-11T10:37:32Z")

</div>

I could replicate the error and i use Google Chrome with latest update

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/ef0c01bc47aecfbb77d4c8eb5187dc3afb36cca8.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 February 2022 15:02 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/17 "2022-02-11T15:02:53Z")

</div>

> [@smanjunath211](#):
>
> I could replicate the error and i use Google Chrome

Could you add that to the github issue please, including how to replicate it.

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [11 February 2022 15:49 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/18 "2022-02-11T15:49:05Z")

</div>

> [@Colin](#):
>
> including how to replicate it

sorry, i meant i could 'see' the problem after copying and deploying the flow provided by @vikingsraven. I could not _replicate_ the issue on my own from scratch.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 February 2022 15:50 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/19 "2022-02-11T15:50:05Z")

</div>

@smanjunath211 I presume you do mean that you are able to create the situation with duplicated wires, not just that you see the wire delete problem once you have duplicate wires. The wire delete problem is not a significant issue as it should not be possible to get into that situation in the first place.

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [11 February 2022 15:53 UTC](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043/20 "2022-02-11T15:53:52Z")

</div>

Yes, i am _unable_ to create the situation where 2 wires are shown simultaneously connected between 2 nodes.

[Next page](https://discourse.nodered.org/t/possible-bug-ui-dashboard-switch-node-or-function-switch-node/58043.md?page=2)
