Shiny action button that can conditionally fetch data, or run calculations (or do both)

I have a unique situation that I was wondering if anyone could help brainstorm.

My Shiny app has a selection of dropdowns, where users can select dates, names etc. Followed by three action buttons: Import, Run, and Reset. Generally, they should be clicked in order, Import > Run. But sometimes, user can just click Run, and it should have same functionality as Import and Run.

Import Button > fetches data from database and renders in data-table output.
Run Button > Must run calculations on the data-table that Import rendered, and render new tables to be output elsewhere in application. However, If user, forgets to fetch data from database, then Run button must fetch the data, and then output that table. Then run calcs, and render the new table elsewhere as well. Reset Button > Just clears the data table that Import created.

I am having trouble getting the Run button to Import & Run calculations (if user forgets to click Import first. Can this be done?

Right now, I am getting "an error has occurred" displayed. Run button renders the initial table like in Import, but not the table that is rendered after calcs are done. How, can I change the code so that, the output waits until the Run button eventReactive has finished getting data from database and then runs calcs and outputs new table? (it only works if the user already clicked import and then clicked run, but not in the case when he only clicks Run)

`rv <- reactiveValue() // for storing table data from "import"`

`data <- eventReactive(input$import, {
 // fetch data
})`

`observe({ //database import event
rv[["dbdata"]] <- data()
})`

`observeEvent(input$import, {
if (is.null(rv["dbdata"]){
   //fetch data from db.
   rv[["dbdata"]] <- data()  // set reactive value to db data 
} 
})`

`calcs <- eventReactive(input$run, {
 // run calcs on data
  .. uses input$dbdata to run calcs. 
})`

`data <- observeEvent(input$reset, {
 // clears rv `


`output$dbdata <- (
  //renders table from "import"
)`

`output$summary <- DT::.... {
 // renders summary table from calcs().
}
//
})`