I am trying to use a basin, and then update the possible choices of sub-basins within that basin.
However, my code is not working. I cannot make it work neither with observe, nor with reactive, nor with observeEvent nor without all of them.
My ui side is as:
selectInput(inputId = 'countyType_id',
            label = '1. Select a basin',
            choices = all_basins
            ),
selectizeInput(inputId = 'subbasins_id',
               label = '2. Select subbasins', 
               choices = subbasins, 
               selected = head(subbasins, 1),
               multiple = TRUE)
and the server side looks like :
observe({
    #
    # from 
    # https://shiny.rstudio.com/reference/shiny/latest/updateSelectInput.html
    #
    subbasins <- sort(unique(curr_spatial$subbasin))
    # Can also set the label and select items
    updateSelectizeInput(session, 
                         server = FALSE, 
                         "subbasins_id",
                         label = "2. Select subbasins",
                         choices = subbasins,
                         selected = head(subbasins, 1)
                         )
    #  It seems the followin has no effect:
    # and when it is outside observe, it produces errors!
    curr_spatial <- curr_spatial %>% 
                    filter(subbasin %in% input$subbasins_id) %>% 
                    data.table()
  })
Any input? please. I did put the data and the whole code in google drive: https://drive.google.com/file/d/1qaZG6-VmBhIgMsxs5dffX9PmagkMhuB8/view?usp=sharing
 
    