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

Example app causes javascript error using latest dev version #73

Closed
daattali opened this issue Dec 3, 2020 · 1 comment
Closed

Example app causes javascript error using latest dev version #73

daattali opened this issue Dec 3, 2020 · 1 comment

Comments

@daattali
Copy link
Contributor

daattali commented Dec 3, 2020

Running the sample code from the README using the latest github version results in a javascript error that prevents the page from working:

library(shiny)
library(waiter)

ui <- fluidPage(
    use_waiter(), # include dependencies
    waiter_show_on_load(),
    actionButton("show", "Show loading for 3 seconds")
)

server <- function(input, output, session){
    
    observeEvent(input$show, {
        
        waiter_show( # show the waiter
            spin_fading_circles() # use a spinner
        )
        
        Sys.sleep(3) # do something that takes time
        
        waiter_hide() # hide the waiter
    })
    
}

shinyApp(ui, server)

JS error:

Uncaught TypeError: Shiny.setInputValue is not a function
at show_waiter (waiter.js:111)
at (index):28

Looks like perhaps it's trying to run before shiny loads

@JohnCoene
Copy link
Owner

Yes indeed, thanks for reporting this Dean! setInputValue before shiny connected.

Moreover there is an issue in the example which runs waiter_show_on_load but never calls waiter_hide; hence the infinite loading screen.

library(shiny)
library(waiter)

ui <- fluidPage(
    use_waiter(), # include dependencies
    actionButton("show", "Show loading for 3 seconds")
)

server <- function(input, output, session){
    
    observeEvent(input$show, {
        
        waiter_show( # show the waiter
            spin_fading_circles() # use a spinner
        )
        
        Sys.sleep(3) # do something that takes time
        
        waiter_hide() # hide the waiter
    })
    
}

shinyApp(ui, server)

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