angular-tree-component icon indicating copy to clipboard operation
angular-tree-component copied to clipboard

Tree is showing updates. Need to click on the screen to show.

Open lesianocmn opened this issue 4 years ago • 4 comments

Hello,

I have an issue with showing the tree.

Before after adding nodes you could see the information. Now I have to click on the screen to see the tree with the nodes. (if not it continues showing "loading")

I checked and If I add a setTimeout with anything there after change the tree, it is showing again.

    setTimeout(function () {
      let something = 0;
    }, 1400);

I'm missing something or do I have to change something?

Thanks for your help.

lesianocmn avatar Mar 04 '21 09:03 lesianocmn

How are you adding the nodes? I tried it with the normal getChildren function and also with just resetting the nodes after the page loaded. Both work for me without clicking.

tobiasengelhardt avatar Mar 12 '21 10:03 tobiasengelhardt

Hello, Thanks for your comment. I'm also resetting the nodes and I'm using the getChildren function. I kind find out a solution using ChangeDetectionStrategy OnPush.

lesianocmn avatar Mar 17 '21 13:03 lesianocmn

I had the same problem. The tree showed after click only.

I tried several workarounds. This works for me:

  constructor(private ref: ChangeDetectorRef){}

  ngOnInit() {
    this.myService.getNodes().subscribe(nodes => {
      this.nodes = [...nodes];
      this.ref.detectChanges();
    });
  }

It worked before I migrated to angular v 12 and material. No idea if there's a connection

colorcube avatar Jul 05 '21 09:07 colorcube

Hi @colorcube ,

Yes, It's what I did.. I think it's the only solution by now..

lesianocmn avatar Jul 05 '21 11:07 lesianocmn