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

getPathNodes should not return the whole tree for an empty path #8

Open
plequang opened this issue Aug 29, 2017 · 3 comments
Open

getPathNodes should not return the whole tree for an empty path #8

plequang opened this issue Aug 29, 2017 · 3 comments
Assignees

Comments

@plequang
Copy link
Contributor

Description

Currently, the implementation of getPathNodes in DefaultTree returns the whole tree when the pathLocator argument is null, undefined or empty.

if (!pathLocator) {
return tree;
}

I think it should rather return an empty array, as an empty pathLocator does not represent any node of the tree. Also, other function in DefaultTree expect getPathNodes to return an array.

@JaySunSyn
Copy link
Contributor

JaySunSyn commented Aug 29, 2017

I think you are right if we only consider cosmoz-tree. However an empty path locator represents the root path in the cosmoz-treenode-navigator.

=> What def should be changed is returning roots instead of treeData so the function always returns an array.

I guess we have those possibilities on an empty path:
a) we return an empty array & implement the respective changes in the navigator
b) we return the roots array
c) we return nodeObj as array

What do you think?

@JaySunSyn
Copy link
Contributor

see also #6 (comment)

@JaySunSyn
Copy link
Contributor

JaySunSyn commented Aug 29, 2017

I have another one @plequang
d) if (pathLocator === '') return roots & else if (!pathLocator) return []

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

No branches or pull requests

2 participants