I have a Web App for Miro that start an action from a Panel. once I click in a panel button I start and action moving cards in the board. The problem is that when I close the panel, the action stops. I know that this is the expected behavior for Panels, but I would need that the action keeps running even after the panel is closed.
What kind of Framework are you using for the frontend? Could you maybe use something like a serverless function from NextJS/Netlify to handle the request? (Basically you call the server endpoint, which in turn does the desired actions on the Miro board async outside of the panel itself, meaning it will run even when the board is closed)
I’m using Vite. I think that is the default framework for Miro Web apps. Just to clarify one point. I’m trying to keep the app running after closing the panel not the board.
Is your suggestion still the best approach?
Another alternative to Addison’s robust server side solution.
One concept I’ve been exploring is using the headless iframe to do the long running work.
The headless iframe is usually used to listen for the icon click on the board and runs as long as the board is open:
When you open a panel, this opens another iframe that only exists as long as the panel is open.
Instead of including the code for the long running task in the panel js, you could use the panel js to trigger the long running task in the headless iframe. You could do this with the postMessage api:
In the app panel you could get the open frames your origin and post a message to each.
Then in your page that’s listening for the
"icon:click"event, you could also listen for the message sent by the app panel, and use the message contents to trigger the corresponding long running task.
This way the long running task is offloaded to headless iframe which will run as long as the board is kept open.
I’ve tried this with one use case and it seems work quite well. Hope this helps.