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

Fixed the regression in addChildNodes #24

Merged
merged 4 commits into from Jan 30, 2018
Merged

Fixed the regression in addChildNodes #24

merged 4 commits into from Jan 30, 2018

Conversation

acierto
Copy link
Contributor

@acierto acierto commented Jan 30, 2018

Hey,
I found one more regression introduced in v0.14.*

Currently the issue in the addChildNodes.
If you call addChildNodes it will append children and open them immediately, regardless of the status of the parent node, was it opened or not.

That leads to a broken state of the tree. Those nodes which user see are not usable anymore, and when you click on parent toggler these nodes will be duplicated and you can operate only with them.

@coveralls
Copy link

coveralls commented Jan 30, 2018

Coverage Status

Coverage increased (+0.01%) to 82.218% when pulling b429ade on acierto:master into ca7829d on cheton:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 82.207% when pulling 2087602 on acierto:master into ca7829d on cheton:master.

@cheton
Copy link
Owner

cheton commented Jan 30, 2018

The "if" statement should handle only this.nodes and this.rows, so the parent node will have chance to update content after adding new child nodes. For example, assume that there is a label aside the parent node, showing a total number of its descendant child nodes.

image

if (parentOffset >= 0) {
    if (parentNode.state.open === true) {
        // Update nodes & rows
        this.nodes.splice.apply(this.nodes, [parentOffset + 1, deleteCount].concat(nodes));
        this.rows.splice.apply(this.rows, [parentOffset + 1, deleteCount].concat(rows));
    }

    // Update the row corresponding to the parent node
    this.rows[parentOffset] = this.options.rowRenderer(parentNode, this.options);
}

@acierto
Copy link
Contributor Author

acierto commented Jan 30, 2018

Yes you are right, applied a feedback!

@acierto
Copy link
Contributor Author

acierto commented Jan 30, 2018

Would be it possible to release a new version today based on this fix?
As we have a release tomorrow, a bit critical for us.

@cheton
Copy link
Owner

cheton commented Jan 30, 2018

Sure! I will publish a new release soon.

@cheton cheton merged commit 0ca1dc1 into cheton:master Jan 30, 2018
@cheton
Copy link
Owner

cheton commented Jan 30, 2018

Published v1.14.7

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.

None yet

3 participants