'shinyStore issue saving f7SmartSelect with multiple selection with Error in unclass(x) : cannot unclass an environment

I am trying to build a shiny app with shinyMobile, and storing the results using shinyStore, I have been looking at several answers but I haven't been able to fix this. I think there might be an issue with the multiple option.

Here is the code

library(shiny)
library(shinyMobile)
library(shinyStore)

Species_List <- structure(list(Scientific_name = c("Juncus alpinoarticulatus ssp. nodulosus", 
                                   "Diphasiastrum complanatum ssp. complana-tum", "Rubus macrophyllus", 
                                   "Equisetum scirpoides", "Trifolium hybridum ssp. hybridum", "Narthecium ossifragum", 
                                   "Peucedanum oreoselinum", "Sonchus oleraceus", "Juncus subnodulosus", 
                                   "Minuartia viscosa"), Danish_name = c("siv, stilk-", "ulvefod, flad", 
                                                                         "brombær, storbladet", "padderok, tråd-", "kløver, alsike-", 
                                                                         "benbræk", "svovlrod, bakke-", "svinemælk, almindelig", "siv, butblomstret", 
                                                                         "norel, klæbrig")), row.names = c(NA, -10L), class = "data.frame")

shinyApp(
  ui = f7Page(
    title = "Species app",
    f7SingleLayout(
      navbar = f7Navbar(
        title = "Select Species",
        hairline = TRUE,
        shadow = TRUE
      ),
      toolbar = f7Toolbar(
        position = "bottom",
        f7Link(label = "Link 1", href = "https://www.google.com"),
        f7Link(label = "Link 2", href = "https://www.google.com")
      ),
      initStore("store", "shinyStore-ex1"),
      # A button to save current input to local storage
      actionButton("save", "Save", icon("save")),
      # A button to clear the input values and local storage
      actionButton("clear", "Clear", icon("stop")),
      # main content
      f7Shadow(
        intensity = 16,
        hover = TRUE,
        f7SmartSelect(inputId = "SpeciesListSc",
                      label = "Select all species",
                      multiple = TRUE,
                      choices = unique(Species_List$Scientific_name),
                      virtualList = T,
                      openIn = "sheet")
      )
    )
  ),
  server = function(input, output, session) {
    observe({
      if (input$save <= 0){
        updateF7SmartSelect(session, inputId = "SpeciesListSc", selected = isolate(input$store)$SpeciesListSc, choices = unique(Species_List$Scientific_name), multiple = TRUE)
      }
    })
    
    observe({
      if (input$save > 0){
        updateStore(session, name = "SpeciesListSc", isolate(input$SpeciesListSc))
      }
    })
  }
)

Any help would be amazing



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source