Skip to main content

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?

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:
https://developers.miro.com/docs/the-windowmiro-object#section-broadcast-data
and the listen to the BROADCAST_DATA event:
https://developers.miro.com/docs/namespace-sdk#section-event-type
 

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.

 

Daniela


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:


Reply