setDataProperty with image not rendering

I have a diagram transaction where I want to update images (icons) bound by the source property on a Picture shape. Very close to the following:

diagram.model.commit(model => {
  model.nodeDataArray.forEach(node => {
    model.setDataProperty(node, 'icon', newIcon);
  }
});

The model is updated right away after commit, and the network tab shows that the request is made for the new image. The old image is also removed. However, the new image does not show - it is simply blank. It is not until there is an interaction with the diagram (canvas click, link click, etc) that the icon shows up.

If I call diagram.redraw() after the commit, nothing changes. However, if I wrap it in a setTimeout with a 2 second delay, it forces the image to show properly. Is there a better way to ensure that the new icon will show, whether it’s a different API or hooking to a different event on the diagram?

Thank you in advance!

What version are you using? Does it change if you switch to 2.1.50?

So, I didn’t realize we are 46 updates behind, all the way back at 2.1.4. I will try updating and post again if there are still issues. Thank you!

For others, this line in particular is encouraging:

Changes for 2.1.50

  • Fixed diagram not redrawing after images load in frameworks that use a shadow DOM, such as Angular.