Skip to content

Respect addAsFirstChild in addNodeUnderParent #480

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

Merged

Conversation

manuelmager
Copy link
Contributor

@manuelmager manuelmager commented Apr 25, 2019

Expected Behavior

When adding a new node to an existing treeData using addNodeUnderParent, I can get it to be the first element directly under root by passing parentKey: null, addAsFirstChild: true.

Actual Behavior

The flag addAsFirstChild is not respected, the new node is always appended as last child.

Steps to reproduce

    const result = addNodeUnderParent({
      treeData: [
        { key: 0, children: [] },
        { key: 6 },
      ],
      newNode: { key: 'new' },
      parentKey: null,
      getNodeKey: ({ node }) => node.key,
      addAsFirstChild: true,
    });

@manuelmager manuelmager changed the title respect addAsFirstChild when parentKey… Respect addAsFirstChild in addNodeUnderParent Apr 25, 2019
@coveralls
Copy link

coveralls commented Apr 25, 2019

Coverage Status

Coverage decreased (-0.002%) to 75.577% when pulling 61db04d on manuelmager:fix/AddNodeUnderParent into cdc5fa3 on frontend-collective:master.

@wuweiweiwu wuweiweiwu self-assigned this May 3, 2019
Copy link
Member

@wuweiweiwu wuweiweiwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

can you run prettier?

@manuelmager
Copy link
Contributor Author

Should be pretty now. :)

@lifejuggler lifejuggler merged commit f78e45e into frontend-collective:master Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants