Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Nested and duplicate command events

GillesJrBisson
Participant

Nested and duplicate command events

GillesJrBisson
Participant
Participant

Hi,

I am currently developing an add-in that has two commands, one of which has a command dialog. While in the command dialog, a thread is launched that produces some value once in a while. When a new value is ready, the thread fires a CustomEvent. In the CustomEventHandler, I update a TextBoxCommandInput form the command dialog with the new value. As a result of this change of input, a new preview of my command is generated.

 

But in practice, I see two issues when I execute this code:

 

1) The ExecutePreviewHandler is invoked RECURSIVELY, while STILL INSIDE the CustomEventHandler. This is really surprising to me. As soon as I set the formattedText on the TextBoxCommandInput, the ExecutePreviewHandler is invoked right away. I would really have expected the event to be fired AFTER as the state might not be ready yet to proceed.

 

2) The second thing that I observed, and that is quite problematic and inexplicable, is that the ExecutePreviewHandler is invoked TWICE. Now since there might be a certain cost involved in generating the preview, there is certainly no need to do it twice for one single change of the TextBoxCommandInput.

 

Here is an example of my debug output console proving my points :

Custom - Enter
ExecutePreview - Enter
ExecutePreview - Exit
ExecutePreview - Enter
ExecutePreview - Exit
Custom - Exit

 

Are these two issues bugs ? Am I doing something wrong ? Any workarounds ? Any thoughts ?

Thanks a lot !

 

2 Likes
Reply
338 Views
0 Replies
Replies (0)