question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deleting a Middle Node leads to all other connectors getting removed from view

See original GitHub issue

I was using the example from dev folder. Delete option was added to NodeType2 in this demo. Instead of adding NodeType2 as the last node ( as given in example ), I added it as a middle node by changing the connections source and target in data.ts file. On deleting the node, the connections are not removed from view or not deleted in few scenarios. @ajainarayanan

Steps to Reproduce issue: Replace the data.ts with the data below. Delete node ( Node Type 2 (action 1) ), add a new node of any type. All the existing connections are removed from view.

export const data = {
  connections: [
    {
      sourceId: "1",
      targetId: "2",
    },
    {
      sourceId: "2",
      targetId: "3",
    },
    {
      sourceId: "2",
      targetId: "4",
    },
    {
      sourceId: "3",
      targetId: "4",
    },
    {
      sourceId: "3",
      targetId: "5",
    },
    {
      sourceId: "4",
      targetId: "5",
    },
  ],
  nodes: [
    {
      config: {
        label: "Default Node",
        type: "source",
      },
      id: "1",
    },
    {
      config: {
        label: "Node Type 1 (action)",
        type: "action",
      },
      id: "2",
    },
    {
      config: {
        label: "Node Type 1 (action)",
        type: "action",
      },
      id: "3",
    },
    {
      config: {
        label: "Node Type 2",
        type: "action",
      },
      id: "4",
    },
    {
      config: {
        label: "Node Type 2",
        type: "action",
      },
      id: "5",
    },
  ],
};

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
etherealm13commented, Jul 8, 2019

@ajainarayanan This works. Closing the issue. Thanks.

1reaction
etherealm13commented, Jul 8, 2019

Can you check the line no. 54 of connectionReducers.ts ?

  if (sourceNode.config.type === 'action' && connObj.sourceId.indexOf('-DottedEndpoint-right') !== -1) {
    newConnObj.sourceId = `${connObj.sourceId.slice(
      0,
      connObj.sourceId.indexOf('-DottedEndpoint-right')
    )}`;
  }
  return newConnObj;
};

Instead of finding the indexOf(“-right”), it should be as above. This fixes the issue. @ajainarayanan

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delete middle of linked list - GeeksforGeeks
Simple solution: The idea is to first count the number of nodes in a linked list, then delete n/2'th node using the simple...
Read more >
Algorithm to delete a node from the middle - Stack Overflow
The main problem is that in your while loop you need to walk through the linked list, and you do not do that:...
Read more >
Delete the Middle Node of a Linked List - LeetCode
Delete the Middle Node of a Linked List - You are given the head of a linked list. Delete the middle node, and...
Read more >
Draw or delete a line or connector - Microsoft Support
If you want to delete multiple lines or connectors, select the first line, press and hold Ctrl while you select the other lines,...
Read more >
Deleting a node - Documentation - Ping Identity
Delete a node to remove it from the flow and break any connections to it.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found