Second appearance of webpanel iframe doesn't initialize window.AP.*

Help please. I have a webpanel in jira-cloud atlassian-connect. It renders an iframe implemented in typescript. When it’s loading, it calles AP.request() and gets back a Promise, all is well.

However, if I click on the button again, causing the iframe to disappear, and then click the button and have the iframe loaded again — AP.request() doesn’t do anything.

Actually, AP.user.getCurrentUser() and similar methods just don’t do anything. They don’t even return a Promise.

It’s easily testable within Chrome, just open & close & open the iframe again, and try AP.user.getCurrentUser() {within the right scope in Console}, it’ll just do nothing.

What should I do? it seems like a bug in all.js. How would you workaround? solve? debug this?

Thanks in advance to all.