Skip to content

Returning undefined from treeWalker throws error #66

@mattvague

Description

@mattvague

Hey there, looks like currently Tree.tsx assumes that treeWalker will always yield valid node data and that it will never be undefined, even though that is a valid return value for yield expressions (there is even a non-null assertion on the yielded value).

I'd like to propose that this behaviour be changed so that undefined values are handled gracefully as it would allow returning early in the case of not having nodes to render yet, etc, whereas right now an Cannot read property 'data' of undefined error is thrown.

@Lodin I'd be happy to PR a fix here but I'm not quite sure what the desired behaviour would be in this case, should I just return early with null inside of generateNewTree?

Anyways, thanks for an otherwise awesome library!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions