Currently, if you call respond() twice successively, there is no ordering guarantee on how the messages in Slack will update. If this is within an interactive message (button or menu), one call will overwrite the other but its a race condition. If its within a dialog submission (or a button or menu using the replace_original: false argument) then two messages will be created but in an arbitrary order.
The only way to rely on the ordering would be to wait on the first call's HTTP response to complete before sending the second call. This can be done by the developer once the return value of respond() is specified (#37), but its still not intuitive.
We can implement a queue with a max concurrency of 1 in the adapter such that calls to respond() are serially sent to Slack. This would result in more intuitive behavior. One recommendation for implementing this queue is the p-queue package (it's also used in @slack/client).
It may also be useful to add an optional parameter that skips the queue and sends the request as soon as possible.
Requirements
[x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
Description
Currently, if you call
respond()
twice successively, there is no ordering guarantee on how the messages in Slack will update. If this is within an interactive message (button or menu), one call will overwrite the other but its a race condition. If its within a dialog submission (or a button or menu using thereplace_original: false
argument) then two messages will be created but in an arbitrary order.The only way to rely on the ordering would be to wait on the first call's HTTP response to complete before sending the second call. This can be done by the developer once the return value of
respond()
is specified (#37), but its still not intuitive.We can implement a queue with a max concurrency of 1 in the adapter such that calls to
respond()
are serially sent to Slack. This would result in more intuitive behavior. One recommendation for implementing this queue is thep-queue
package (it's also used in@slack/client
).It may also be useful to add an optional parameter that skips the queue and sends the request as soon as possible.
Requirements