yes, this is expected behaviour, let me explain why it happens:
- when you toggle component visibility you just change the component “display” property
- changing a component’s properties launches a rerender phase for the component, but it runs an async function to accumulate all the changes and reflects them in UI, for the best performance
- when you hide (display=false) a component is still on the stage but it stops rendering all its children, so they are unmounting and you do not have to them anymore, also for best performance.
- this is why the “wait” block helps, here is a very similar case with async and re-render Binding issue between custom UI components - #2 by vladimir-upirov