Iframe does not always render unless DevTools is open

I have an iframe in an angular page:

The src is dynamically generated. An example is tmp/Kwuvl8JY8vEpzDl_AAAw/index_internal.html. Then the iframe shows the preview of index_internal.html.

Now, I realise that in a tab loading the web page, after certain manipulation, sometimes the iframe oddly does not show anything. But If I open Chrome DevTools and look at Network, and refresh the page, the iframe can render properly; if I refresh without opening DevTools, iframe still may or may not render.

The code of my web page is too complicated to be put here, but does anyone know which may be the cause of this odd behaviour?