dreamRs / esquisse

RStudio add-in to make plots interactively with ggplot2
https://dreamrs.github.io/esquisse
Other
1.77k stars 229 forks source link

dataset not loading in `esquisserServer` unless loaded via `chooseDataServer` #117

Closed ChristopherBarrington closed 4 years ago

ChristopherBarrington commented 4 years ago

In the CRAN version the following mwe works as expected:

ui <- navbarPage(
  title = "My navbar app",
  tabPanel(
    title = "esquisse",
    esquisserUI(
      id = "esquisse",
      header = FALSE,
      container = esquisseContainer(
        fixed = c(50, 0, 0, 0)
      )
    )
  )
)

server <- function(input, output, session) {

  callModule(module = esquisserServer, id = "esquisse", data=reactiveValues(data=data.frame(x=rnorm(100), y=rnorm(100), group=sample(x=letters[1:3], size=100, replace=TRUE)), name='data'))

}

runApp(shinyApp(ui, server))

Using the master branch of the repository, however, the plot is not rendered; no variables are displayed from which to choose aesthetics. I have to use the choose_data process to get a dataset to load.

I think it is this line where the ignoreInit=TRUE means that the initialisation from the server argument is ignored and the reactive only updated after initialised once the load a dataset module is used. In my fork I change set ignoreInit=FALSE and the code works as expected.

Thanks for the work!

pvictor commented 4 years ago

Thanks for reporting that, the ignoreInit seems indeed unnecessary, I removed it. It doesn't affect comportment fixed in https://github.com/dreamRs/esquisse/pull/110

Victor