Tree View does not render child nodes

Hi all,

i’m trying to get a custom tree view working in Theia, but somehow the child node is not rendered.
The root node is rendered, with the expandable icon, but whenever it is expanded the child won’t be rendered. Also resolveChildren is invoked and the child node is created and returned. I also have binded custom label providers for the TreeNode types i’m using.

Here’s the repository: https://github.com/alex0711/TheiaTreeSample
A gitpod config is in the repo so you can directly try it out. The view is called ‘Sample’.

Thanks for the example! You forgot to call super.init() in your tree model. Also, postConsruct is called automatically by the dependency injection framework. Something like this should solve the issue:

diff --git a/sample/src/browser/tree/sample-tree-model.ts b/sample/src/browser/tree/sample-tree-model.ts
index 8289dce..ca0cbe4 100644
--- a/sample/src/browser/tree/sample-tree-model.ts
+++ b/sample/src/browser/tree/sample-tree-model.ts
@@ -1,4 +1,4 @@
-import { injectable, inject } from 'inversify';
+import { inject, injectable, postConstruct } from 'inversify';
 import { CompositeTreeNode, TreeModelImpl } from '@theia/core/lib/browser';
 import { GroupNode, SampleTree } from './sample-tree';
 import { Group, Person } from '../sample';
@@ -12,7 +12,9 @@ export class SampleTreeModel extends TreeModelImpl {
         return this.tree;
     }
 
+    @postConstruct()
     async init(): Promise<void> {
+        super.init();
         this.tree.root = undefined;
 
         const person: Person = {

I hope this helps.

@kittaakos Thanks, that solved the issue :slight_smile: