Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change value of locked binding for 'set_loader' #113

Closed
shahronak47 opened this issue Jan 15, 2022 · 3 comments
Closed

Cannot change value of locked binding for 'set_loader' #113

shahronak47 opened this issue Jan 15, 2022 · 3 comments

Comments

@shahronak47
Copy link

shahronak47 commented Jan 15, 2022

I am trying to run the example from the help page for hostess but it is returning me an error.

library(shiny)
library(waiter)

# diagonal line
path <- "M10 10L90 30"

ui <- fluidPage(
  use_waiter(),
  use_hostess(),
  actionButton("draw", "redraw"),
  plotOutput("plot")
)

server <- function(input, output) {
  
  dataset <- reactive({
    input$draw
    
    hostess <- Hostess$new(min = 0, max = 10)
    hostess$set_loader <- hostess_loader(
      progress_type = "stroke",
      stroke_color = hostess_stripe()
    )
    waiter <- Waiter$new(
      "plot", 
      hostess$loader()
    )
    
    waiter$show()
    
    for(i in 1:10){
      Sys.sleep(.2)
      hostess$inc(1)
    }
    
    runif(100)
    
  })
  
  output$plot <- renderPlot(plot(dataset()))
  
}

shinyApp(ui, server)

This is the error.

Warning: Error in <-: cannot change value of locked binding for 'set_loader'

This is my sessionInfo() -

R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] waiter_0.2.5 shiny_1.7.1 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7       digest_0.6.29    later_1.3.0      mime_0.12        R6_2.5.1         jsonlite_1.7.2   lifecycle_1.0.1 
 [8] xtable_1.8-4     magrittr_2.0.1   cachem_1.0.6     rlang_0.4.12     cli_3.1.0        promises_1.2.0.1 jquerylib_0.1.4 
[15] bslib_0.3.1      ellipsis_0.3.2   tools_4.1.0      rsconnect_0.8.18 httpuv_1.6.5     fastmap_1.1.0    compiler_4.1.0  
[22] htmltools_0.5.2  sass_0.4.0      
@JohnCoene
Copy link
Owner

It looks like you are looking at a very outdated documentation. May I ask where you saw this?

See the correct code the latest version below.

library(shiny)
library(waiter)

# diagonal line
path <- "M10 10L90 30"

ui <- fluidPage(
  useWaiter(),
  useHostess(),
  actionButton("draw", "redraw"),
  plotOutput("plot")
)

server <- function(input, output) {
  
  dataset <- reactive({
    input$draw
    
    hostess <- Hostess$new(min = 0, max = 10)
    hostess$set_loader(
      hostess_loader(
      progress_type = "stroke",
      stroke_color = hostess_stripe()
      )
    )
    waiter <- Waiter$new(
      "plot", 
      html = hostess$get_loader()
    )
    
    waiter$show()
    
    for(i in 1:10){
      Sys.sleep(.2)
      hostess$inc(1)
    }
    
    runif(100)
    
  })
  
  output$plot <- renderPlot(plot(dataset()))
  
}

shinyApp(ui, server)

@shahronak47
Copy link
Author

@JohnCoene I find the example under ?waiter::hostessLoader .

JohnCoene added a commit that referenced this issue Jan 23, 2022
@JohnCoene
Copy link
Owner

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants