Skip to main content

Hi, Recently I have been testing my board extension in numerous real working enviroment boards instead of my test boards. The main difference was widget count on these boards, while I have made 20-30 widgets when testing these boards have 500+ widgets with some exceeding 5000 ( including handwriting where each stroke counts as a widget, these make up a lot of the total).

 

The core of the problem is:

miro.board.widgets.update({
"id" : widgetID2,// just a widget id the user assigns to a certain layer
"clientVisible" : false // makes the widget not visible
})

when I do this, even if I only hide a few (4-5) widgets on a massive 1k+ widget board. The board becomes unresponsive after a few seconds prompts up a “syncing” modal like this:

At this stage there are 2 outcomes:

 

  1. boards under 1k widgets: The sync takes it’s time anywhere from 2-3 seconds to 30 seconds. Then makes the board available to the user again. This is kind of frustrating since I imagined I could hide / show widgets via javascript pretty easily and fast, but still better than nothing.
  2. boards near 1k widgets or over: The sync counts down 30 seconds but never actually syncs. 
    never ending sync
    response from sdk

    My code doesn’t run into errors and actually finishes the job everytime. Which means it hides / shows the widgets that it is supposed to but the sync prevails and will not let the user access the board anymore. Any ideas if there is something I can improve on my end or if this is purely a SDK issue?

For reference this is the whole codeblock I’m using for this functionality:

async function hideSelectedWidgets(layerId) { //hiding widgets
for(let i = 0; i < layerJSObject.length; i++) {// I store each layer in a JS object and inside each object there is a array of widget id's each one is stored as string

if(layerJSObject(i].LayerID == layerId) { //checking if the clicked icon has same id as a layer inside object

for(let ii = 0; ii < layerJSObject i].WidgetIDs.length; ii++) { // for each widget id perfrom clientVisible: false
let widgetID2 = layerJSObject i].WidgetIDstii]

await miro.board.widgets.update({
"id" : widgetID2,
"clientVisible" : false
})
}
}
}
await miro.board.selection.clear() // clear selection to not have invisible widgets selected
}

I rewrote this multiple times, making it more efficient each time, omitting excess loops and widget data, keeping only the bare minimum in hopes that the sync is affected by my code, but with no success at all. Is my code really just that inefficient?

 

 

Hello Sami,

 

It is unclear if this is a bug in the SDK or there is something else going on in your code. If you are still experiencing this issue, could you try writing a simple web-plugin that only calls the update method 5 times and try it out in your board with 1k+ widgets? That should give us an idea if the update calls are really slow on those massive boards, or it if the issue is happening somewhere else.

 

Kind regards.

 

Daniela


Reply