Skip to content

Found an issue of the util.js #25

@codTango

Description

@codTango

Hey, I just found that there's an issue for the util. The scenario is that I have multiple trees like this:

[
  {
    "label": "A",
    "value": "1",
    "key": "1",
    "parentId": null,
    "isLeaf": false,
    "children": [
      {
        "label": "A1",
        "value": "2",
        "key": "2",
        "parentId": "1",
        "isLeaf": true
      },
      {
        "label": "A2",
        "value": "3",
        "key": "3",
        "parentId": "1",
        "isLeaf": true
      }
    ]
  },
  {
    "label": "B",
    "value": "4",
    "key": "4",
    "parentId": null,
    "isLeaf": false,
    "children": [
      {
        "label": "BB",
        "value": "5",
        "key": "5",
        "parentId": "4",
        "isLeaf": true
      }
    ]
  },
  {
    "label": "C",
    "value": "8",
    "key": "8",
    "parentId": null,
    "isLeaf": false,
    "children": [
      {
        "label": "CC",
        "value": "9",
        "key": "9",
        "parentId": "8",
        "isLeaf": true
      }
    ]
  }
]

In filterAllCheckedData function, when I select all the root nodes (A B C), and then select some of their children nodes, this checking will push an object with some undefined properties to checkedNodesPositions.

    if (siblingChecked === len) {
      parent.__checked = true;
      checkedNodesPositions.push({ node: parent, pos: parent._pos });

Later, it will throw errors on trying to split on the undefined property within flatToHierarchy function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions