Pass a long string to modal

  • 6 March 2021
  • 3 replies

Dear miro team,

I have to pass a long string to a modal when it’s being open. The app is supposed to run at client side only, and wrigin the string to board, then reading it from the modal is not a good option.

This is the sudo code:

`miro.board.ui.openModal('./editor.html', { dataToBePassedToModal: text })`

Is that possible?


Best answer by Daniela Gavidia 19 March 2021, 00:07

View original

3 replies

Userlevel 4

Hello Mohsen,


As you have already noticed, the openModal method in the SDK does NOT support passing data. You can use board metadata to store the string there and then read it from the modal:

Write to the board metadata:

await miro.board.metadata.update({'<YOUR_APP_ID>': {"data": "hello"}}

Read from the board metadata:

await miro.board.metadata.get() 


Another option would be to use the broadcastData() method:
and the listen to the BROADCAST_DATA event:

However, the BROADCAST_DATA event is experimental and I have found it to not be very reliable. We are in the process of building a more robust solution.


I hope this helps.



Thank you Daniela,

Unfortunately await miro.board.metadata.get() is also experimental. Since I’m building a production ready app I can’t use something that may change at any moment.

The the interactions of my users require a large screen, so I really need to open modal, and I have to pass the data to the modal,.. I got stuck here. 


Oh I realized that writing to metadata and then reading it from modal is prone to concurrency issues.:sob: