The layoutInfobox component has multiple child components. When destroying layoutInfobox, do its children get destroyed automatically, or do I have to destroy them individually?
I found that destroy() cannot truly remove the component from the Instance.
How do I destroy components from the Instance? My app creates a large number of components dynamically, and their properties keep changing constantly. If the components are not destroyed in a timely manner, a great many of them will pile up inside the Instance.
For situations like this with sequential control projects, you might need to try deploying the project in lifecycle mode. Namespace: Lifecycle
How should I do this specifically? Which method should I use?
Sorry for misunderstanding you. You meant you want to clear the Instance’s large dictionary object when the component is destroyed.
We have provided a method called onDestory for custom components and a method called onDispose for basic components, but there’s still a minor issue with the onDispose method at the moment…
It is recommended that you set up an event listener when the component is mounted…
this.once('before:destroy',()=>{
Logger.i("Input dispose");
try{
// Which component instance you want to delete.
delete Instance.Input_8;
}catch(e){
Logger.e(e);
}
})
Currently, AppStudio v1.3.0 recursive destroy between parent and child cannot be achieved…