Skip to content
This repository has been archived by the owner on Feb 28, 2021. It is now read-only.

Latest commit

 

History

History
88 lines (58 loc) · 2.24 KB

README.md

File metadata and controls

88 lines (58 loc) · 2.24 KB

reactlog

Build Status

reactlog extends Shiny with new features that make it easier to debug and trace reactivity, especially in larger apps.

Analyze the reactive log in R

  • Print the call stack that caused invalidation (rstudio/shiny#1846)
  • List reactive dependencies in a tree structure

Demo

Reactive log visualizer enhancements

Demo

Installation

# install.packages("devtools")
devtools::install_github("glin/reactlog")

Usage

options(shiny.reactlog = TRUE)

rxA <- reactive({
  input$A
})

observe({
  # call it in a reactive context
  reactlog::traceInvalidation()
  rxA()
})

# or on a reactive expression/observer
reactlog::traceInvalidation(rxA)
reactive({
  # when multiple dependencies change, it might be useful to see them all
  # not just the one that invalidated the context
  reactlog::listDependencies()
  rxA() + input$A + input$B
})

# also works
reactlog::listDependencies(rxA, invalidated = TRUE)

# when called without a reactive context, shows the entire dependency tree
reactlog::listDependencies()
# show the graph for the most recent session
reactlog::showReactGraph()

observe({
  # show the graph filtered on this observer and its dependencies
  reactlog::showReactGraph()
})

API

https://glin.github.io/reactlog/reference/index.html

Caveats

reactlog is experimental and relies on Shiny internals which are subject to change. Use at your own risk, for debugging and development only!