Tree Component: Losing child checks on parent collapse

I am using build 4.33.3 and it seems from the forums this issue had been corrected a couple years ago, so I assume it is something I am doing. When I collapse a parent level, any of the immediate children that have been checked, become unchecked. Interestingly children at the next level down remain checked.


Here is the code that is called on expand:

 public void LoadFiles(TreeExpandEventArgs args)
 { //called when expand is clicked
     var directory = args.Value as string;

    
                             directoryentries = Directory.GetDirectories(directory)
                               .Where(entry =>
                               {
                                   var name = System.IO.Path.GetFileName(entry);

                                   return !name.StartsWith(".") && name != "bin" && name != "obj";
                               });

                     fileentries = Directory.GetFiles(directory)
                                       .Where(entry =>
                                       {
                                           var name = System.IO.Path.GetFileName(entry);

                                           return !name.StartsWith(".") && name != "bin" && name != "obj";
                                       });

                     childentries = directoryentries.Concat(fileentries);
                     args.Children.Data = childentries;
                     args.Children.Text = GetTextForNode;
                     args.Children.HasChildren = (path) => (IsDirectory((string)path));
                     args.Children.Template = CustomTemplate;

                
 }

It is not just a UI issue either. The first child level items get removed from the CheckedValues list. I can't figure out what I am doing that is causing this. Thanks for any suggestions or insights.

Check our example to know how to use ItemRender event to control paren checked state with collapsed children: