In a given reactive, is there a method/option to get the reactive element(s) that triggered it?


#1

For example, I could simply add a print statement at the beginning of my reactive of interest to find out each time what triggered it?

reactive_example <— reactive({
print(last_trigger())
_#Rest of reactive logic..._
)}

Same question on stackoverflow…
and the github discussion where this exact feature is asked for by shinyjs author @daattali and @jcheng seems interested…


#2

I don’t think this exists. The github issue is probably the best way to track this. If it does get implemented, I’m 99% sure the github issue will get updated


#3

This is pretty much a hack, but achieves this without requiring any changes to Shiny.

Check out my last comment on the GitHub issue for a quick write-up, and an example of another method you might be able to use. https://github.com/rstudio/shiny/issues/1846#issuecomment-361831280