steven mosher
steven mosher

Reputation: 11

R Shiny: session object not found

I have a UI that includes a navbarpage and 3 tabPanels. The first tabPanel has widgets for selecting files. once the users finishes selecting the files, there is a update button which is watched by observeEvent. Wehn the button is pressed, urls are accessed and a table is filled. I want the panel to automatically switch. So I used updateNavbarPage as seen in the code below.

This throws and error that "session" can not be found. After throwing this error by whole enviroment is trashed and even if I remove the call to updateNavPage the code refuses to run unless i shut down and start over

library(shiny)





shinyServer(function(input, output,sesson) {

  MY_DATA <- NULL



  fetch_files <- reactive({
    spatial   <- input$spatial
    location  <-input$location
    time      <-input$time
    metric    <-input$metric
    stat      <- input$stat
    provider  <- input$provider
    processing <- input$processing

    X <- FILES %>% filter(Spatial %in% spatial & Locale %in% location & Time 
                                  %in% time & Processing %in% processing & 
                                   Metric %in% metric &
                                  Stat %in% stat & Provider %in% provider)
    return(X)

  })

  display_files <- reactive({
    D <- fetch_files() %>% select(-DOI,-AccessDate,-Url,-DataID)
    return(D)

  })

  observeEvent(input$fetchData,{
    updateNavbarPage(session,inputId="main",selected="transform")
    MY_DATA <<- download_data(fetch_files())

  })

  output$active_data <-renderDataTable(MY_DATA)


  output$data_to_fetch <-renderDataTable( 
    display_files()
   )

})

Upvotes: 1

Views: 3953

Answers (1)

Mal_a
Mal_a

Reputation: 3760

I just assume by first look on Your code that You made a typo:

shinyServer(function(input, output,sesson){...

You should write session instead of sesson:

shinyServer(function(input, output,session){... 

Upvotes: 2

Related Questions