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

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..

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

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. Feature request: for debugging, would be very useful to know which reactive caused invalidation ยท Issue #1846 ยท rstudio/shiny ยท GitHub

1 Like