I'm modifying a reactive value inside an observeEvent. I have another observe chunk which calls this reactive value. I expect the observe chunk to be triggered at the end of the observeEvent chunk given this reactive value dependency but that seems to not be happening. Is that expected behaviour?
http://shiny.rstudio.com/reference/shiny/latest/reactiveValues.html says - "When you read a value from it, the calling reactive expression takes a reactive dependency on that value, and when you write to it, it notifies any reactive functions that depend on that value."
In the below example, everytime I click the button, I expect cat with 2 to be output, and depending on the value of counter, the cat with the 3 to be output too. That isn't the case, and the output typically prints the cat with 1 but not the cats with 2 and 3.
server.r
shinyServer (
function(input, output, session) {
lReactiveValues = reactiveValues(a = 1.1)
voidaA = observeEvent(
input$buttonCommit,
{
a = runif(1)
cat(a,' 1\t')
lReactiveValues$a = a
}
)
voidB = observe({
counter = runif(1)
cat(counter,' 2\t');
if (counter > 0.5) {
cat('\n')
cat(lReactiveValues$a,' 3\n')
}
}
)
}
)
ui.r
dashboardPage(
dashboardHeader(
title = "Analytics"
),
## Sidebar content
dashboardSidebar(
menuItem("Analysis", tabName = "tabAnalysis", icon = icon("calculator"))
),
## Body content
dashboardBody(
tabItems(
tabItem(
tabName = "tabAnalysis",
actionButton("buttonCommit", "Commit!")
)
)
#, style='width: 100%; height: 100%;'
)
)