I have a shiny app that utilizes eventReactive and actionButton. The app has four tabs. The first tab is "instructions" where no output is rendered, while the second and third tab both display results (renderTable and renderPlot). The app runs a simulation and normally takes 1.5 minutes to run.
Unfortunately, when the user presses the action button, the app does not start running. It only starts running once the user presses the action button and then selects the results page.
I assume this is not intended? Is this a bug or is there a workaround for this? Simple reprex below:
---
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
source_code: embed
always_allow_html: yes
---
knitr::opts_chunk$set(echo = FALSE)
Sidebar {.sidebar}
=====================================
numericInput("sampsize", "Input Sample Size",value=NULL)
actionButton("go", "Submit")
n <- eventReactive(input$go,{input$sampsize})
example <- function(test){
Sys.sleep(10)
print("Hello")
}
results <- eventReactive(input$go, {
example(test)
})
Results
=====================================
Row {data-height=600, .tabset}
-----------------------------------------------------------------------
### Instruction Page
#some text
### Results Page
renderPrint({
results()
})