Skip to content

go-to doesn't work with async function #27

@gillez

Description

@gillez

When initialising finder using an async function rather than static array, the "go-to" event does not work.

The following error is seen in the console:

TypeError: n.find is not a function at Function.finder.selectPath (vendor/finder.min.js)

This is because finder.selectPath is passed the original "data" and expects this to be an array, calling data.find to get the path. However, in this case data is a function and the above error occurs.

I know that go-to may not be possible to find a path which hasn't been retrieved by the async function (and defaultPath wouldn't work at all for the same reason). However, in my case I am emitting go-to to navigate to a path that I know is in the data that already exists in the tree.

What I really want to do is automatically select the top-level child if there is only a single top-level child after building the tree in the async function. Is there a way to do this?

Thanks,
Giles

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions