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

Asynchronous execution in doForAll is unexpected #928

Open
sechel opened this issue Oct 26, 2021 · 0 comments
Open

Asynchronous execution in doForAll is unexpected #928

sechel opened this issue Oct 26, 2021 · 0 comments

Comments

@sechel
Copy link

sechel commented Oct 26, 2021

I try to execute a function for all nodes in the tree and tried using the doForAll tree model function. I was surprised to learn that the corresponding method on the nodes is executed asynchronously:

  doForAll(fn: (node: ITreeNode) => any) {
    Promise.resolve(fn(this)).then(() => {
      if (this.children) {
        this.children.forEach((child) => child.doForAll(fn));
      }
    });
  }

That comes unexpected and is IMO undocumented and may be a bug.

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

1 participant