title: Shiny Dashboard: Reset the conditional panel state when we navigate across different tabitems
body: <p>I have the following code in which there are various conditional panels in the dashboard. If we navigate from one conditional panel to next in dashboard and then go to widget and finally come back to dashboard, the dashboard is in the previous state. I want the dashboard to be refreshed(reset to original condition) when I come back from another tab panel. Is is possible to do that?</p>
  
  <pre><code>library(shiny)
  library(shinydashboard)
  library(maps)
  library(leaflet)
  
  ui &lt;- dashboardPage(
    dashboardHeader(title = "Dashboard"),
    dashboardSidebar(sidebarMenu(
      menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
      menuItem("Widgets", tabName = "widgets", icon = icon("th"))
    )),
    dashboardBody(
      tabItems(
        # First tab content
        tabItem(tabName = "dashboard",
        tags$script("
                    Shiny.addCustomMessageHandler('resetInputValue', function(variableName){
                    Shiny.onInputChange(variableName, null);
                    });
                    "),
  
        conditionalPanel(
          condition &lt;- "input.link_click  === undefined || input.link_click === null",
          leafletOutput("Map", width = 1000, height = 500)
  
        ),
  
  
        conditionalPanel(
          condition &lt;- "(input.link_click_Site  === undefined || input.link_click_Site === null) &amp;&amp; (input.link_click  !== undefined &amp;&amp; input.link_click !== null)",
  
          leafletOutput("CountryMap", width = 1000, height = 500)
  
        ),
        conditionalPanel(
          condition &lt;- "(input.link_click_Site  !== undefined &amp;&amp; input.link_click_Site !== null)",
  
          h3("Plots related to site chosen"),
          textOutput(outputId = "Check"),
          actionButton("Back", "Back")
        )
       ),
       tabItem(tabName = "widgets",
               h3("This is widget page")
  
               )
       )
    )
  )
  
  
  server &lt;- function(input, output, session){
    Country = map("world", fill = TRUE, plot = FALSE, regions="USA")
    output$Map &lt;- renderLeaflet({
      leaflet(Country) %&gt;% addTiles() %&gt;%  setView(0, 0,  zoom = 2)%&gt;%
        #leaflet(target) %&gt;% addTiles() %&gt;%
        addPolygons(fillOpacity = 0.6,
                    fillColor = 'blue',
                    smoothFactor = 0.5, stroke = TRUE, weight = 1, popup =  paste("&lt;b&gt;", "USA", "&lt;/b&gt;&lt;br&gt;",
                                                                                  actionLink(inputId = "View", 
                                                                                             label = "View Details", 
                                                                                             onclick = 'Shiny.onInputChange(\"link_click\",  Math.random())')))
    })
  
    output$CountryMap &lt;- renderLeaflet({
  
      leaflet(Country) %&gt;% addTiles() %&gt;%   
        fitBounds(Country$range[1], Country$range[3], Country$range[2], Country$range[4])%&gt;%
        addMarkers(lng = -71.03 , lat = 42.37, popup = paste("&lt;b&gt;", "Boston", "&lt;/b&gt;&lt;br&gt;",
                                                             actionLink(inputId = "View", 
                                                                        label = "View Details", 
                                                                        onclick = 'Shiny.onInputChange(\"link_click_Site\",  Math.random())')))
    })
  
    observeEvent(input$link_click_Site, {
      output$Check &lt;- renderText("Success")
  
    })
  
    observeEvent(input$Back, {
      session$sendCustomMessage(type = 'resetInputValue', message = "link_click_Site")
      session$sendCustomMessage(type = 'resetInputValue', message = "link_click")
    })
  
  }
  
  
  shinyApp(ui =ui, server = server)
  </code></pre>