Serious XD plugin cycle bug/design flaw

My new plugin is doing some long async extraction work under editDocument() (sometimes taking several seconds), creating and deleting text/rectangle nodes, writing files, etc., and I discovered to my surprise/horror :wink: , that XD will actually call the (panel) pluginā€™s update() during this process.

I.e., itā€™s treating the plugin as re-entrant, which it most certainly isnā€™t (donā€™t think any plugin is ready for that). React, in particular, is unhappy about this situation.

I worked around it by setting a guard bool during the editDocument(), and dismissing immediately any attempts at re-entry via update().

But I claim this is either a bad bug or a design flaw: you canā€™t expect a panel plugin to handle an update() when itā€™s in the middle of a promise-based editDocument() process.

(@kerrishotts or @peterflynn would be likely candidates to respondā€¦)

1 Like

Or, if intended, this should at least be clearly documented :wink:

Boy, donā€™t know how this could be intended, since itā€™s asking a panel plugin to be re-entrant.

I think itā€™s just a bug thatā€™s never been found before, since it only occurs once in a while with extended work being done in editDocument().

I agree (even if this might be an interesting question regarding how it could be solved differently with ā€œexternal updatesā€ in cloud documents), Iā€™m just saying that if it is intended (or even if it isnā€™t, but canā€™t be fixed immediately), it should at least be documented :slightly_smiling_face: