Best practices or approach to generate reports using R markdown

I have a shiny app with 10 tabs. Each tab has 4 dropdowns where values differ based on the tab. Also each tab has a couple of tables and plots. Now I am trying to generate a report using r markdown template. The issue I get is the report would be generated only for the current tab I am on. So I used outputOptions. But it doesnt seem to work with updatePickerInput.

observeEvent(input$tab, {
  if (input$tab == "fruits"){
    choices <- c(
  else if (input$tab == "vegetables") {
    choices <- c(

  else {
    choices <- c(
                    inputId = "selected_metric",
                    choices = choices)

outputOptions(output, "selected_metric", suspendWhenHidden = FALSE)

Error I get is

Error in .subset2(x, "impl")$outputOptions(name, ...) : 
  selected_metric is not in list of output objects

I would like to understand if this is the right way of doing it or do I have a different approach.Thank you.

A post was merged into an existing topic: Error while using outputOptions in R shiny