Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code node doesn't show input data if connected to IF node and data is via false branch #11877

Open
barn4k opened this issue Nov 25, 2024 · 1 comment
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@barn4k
Copy link

barn4k commented Nov 25, 2024

Bug Description

the Code node doesn't show the Input data if it is connected to the IF node and the data goes via false branch
image

To Reproduce

the workflow. The No Op node may be removed. It is only used to draw the arrow better.

{
  "meta": {
    "instanceId": "ea8ccd7cb9d9fc233a4683c7569b952c9669ba9d3ba1459d89a9944d357fa5b3"
  },
  "nodes": [
    {
      "parameters": {},
      "id": "5ec6a044-a0e9-4bea-9872-dcadefff0b04",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        1020,
        480
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "2e4eb938-13f4-47be-9f8d-28b7a0f2a271",
              "leftValue": "={{ $json.code }}",
              "rightValue": 3,
              "operator": {
                "type": "number",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "587a929e-22d6-45ab-bb57-3aee3519f58d",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1200,
        480
      ]
    },
    {
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  item.json.myNewField = 1;\n}\n\nreturn $input.all();"
      },
      "id": "da240ddb-84d5-4286-81ed-5484b962b127",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1900,
        500
      ]
    },
    {
      "parameters": {},
      "id": "7b6d2963-8ba7-49d4-8cc1-bef32f012d24",
      "name": "node can be removed. Leaved for visibility",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1500,
        300
      ]
    }
  ],
  "connections": {
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "node can be removed. Leaved for visibility",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "node can be removed. Leaved for visibility": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {
    "When clicking ‘Test workflow’": [
      {
        "name": "First item",
        "code": 1
      },
      {
        "name": "Second item",
        "code": 2
      }
    ]
  }
}

Expected behavior

input data will show the input data...

Operating System

cloud

n8n Version

1.68.0

Node.js Version

cloud

Database

SQLite (default)

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Nov 25, 2024

Hey @barn4k,

We have created an internal ticket to look into this which we will be tracking as "GHC-493"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

2 participants