topojson entity clone

I try to load .topojson file and clone entities as code below ,but there was an error occured as "Maximum call stack size exceeded",why


var promise = Cesium.GeoJsonDataSource.load('/family-house.topojson');
     promise.then(function(dataSource) {
       var entities = dataSource.entities.values;
         let length=entities.length;
             for (let i = 0; i < length; i++) {
                 for (let j = 0; j < 12; j++) {

                  let house=Cesium.clone(entities[i],true);

     }).otherwise(function(error) {

My best guess is that, since you’re running that clone code inside the promise, the new cloned entity has the same promise, so when that loads, it also clones, which triggers this infinite recursive function.

A better way might be to just check every frame if the data source has finished loading, and then do your cloning there. So something like:

var dataSource = new Cesium.GeoJsonDataSource();

var finishedCloning = false;

// This code will run every frame
// dataSource.isLoading will be false when it’s done loading
if(dataSource.isLoading == false && finishedCloning == false){
// Put all your clone code here