In Brilliant R apps, how can I delay the firing of reactive?
I have it selectizeInput
in my application Shiny
. It is in multiple choice mode, so the user can specify multiple options.
However, reactive items that depend on selectizeInput
fire every time a selection is added. Suppose the user intends to select A
, B
and C
. Currently my application will do this costly computation to select A
, A, B
and A, B, C
when only the latter is required.
The best way I can work out is to delay the launch selectizeInput
by a second or so, so that the user can enter all the options. Each new selection must set a timer for 1 second. I know I Shiny
provide a command invalidateLater
, but this causes jet fire to fire once now and once later.
How can I only react to fire just once?
source to share
You have to debounce to react.
The R implementation is implemented here: https://gist.github.com/jcheng5/6141ea7066e62cafb31c
source to share