knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(shiny) options(shiny.reactlog = TRUE)
valA <- reactiveVal(1, label = "A") createReactive <- function(val, label = NULL) { reactive(val(), label = label) } rxA <- createReactive(valA) rxB <- createReactive(valA, label = "rxB") obs <- observe(rxA() + rxB(), label = "obs") shiny:::flushReact() reactlog::listDependencies(obs)
val <- reactiveVal(1, label = "val") rxA <- reactive(val()) # no curly braces, no source refs rxB <- reactive({ val() }) obs <- observe({ rxA() + rxB() }, label = "obs") shiny:::flushReact() val(2) reactlog::listDependencies(obs, srcref = TRUE)
observer$onInvalidate
callbackslibrary(shiny) options(shiny.reactlog = TRUE) shinyApp( ui = fluidPage( sliderInput("A", "A", 0, 5, 0), sliderInput("B", "B", 0, 5, 0) ), server = function(input, output, session) { rx <- reactive({ input$A + input$B }) obs <- observe({ rx() }) obs$onInvalidate(function() { # slightly less intrusive than placing calls inside the observer reactlog::traceInvalidation(obs) cat("\n") reactlog::listDependencies(obs, invalidated = TRUE) }) } )
https://shiny.rstudio.com/articles/debugging.html
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.