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

Waitress notification with infinite = TRUE does not close #109

Open
vituri opened this issue Oct 15, 2021 · 1 comment
Open

Waitress notification with infinite = TRUE does not close #109

vituri opened this issue Oct 15, 2021 · 1 comment

Comments

@vituri
Copy link

vituri commented Oct 15, 2021

Hi, John!

I use your package in a lot of shinyapps, and up until version 2.2 the below code worked as expected:

library(shiny)
library(waiter)
library(magrittr)

ui <- fluidPage(
  useWaitress(),
  actionButton("btn", "render"),
  plotOutput("plot", height = "90vh")
)

server <- function(input, output){
  some_data = reactive({
    waitress <- Waitress$new(theme = "overlay-opacity", infinite = TRUE)
    waitress$notify('Downloading data...')
    
    Sys.sleep(2)
    
    waitress$close()
  }) %>% 
    bindEvent(input$btn)
  
  output$plot <- renderPlot({
    some_data()
    
    hist(runif(100))
  })
}
shinyApp(ui, server)

I have some slow download operations running on reactives and I like to show an infinite notification, and close it when the slow part is done (usually I close one waitress and exhibit another). But in version 2.3 and 2.4 the w$close() doesn't work anymore.

image

Do you know any fix for that?

@vituri
Copy link
Author

vituri commented Mar 2, 2022

Update: the problem is more general. The whole Waitress does not disappear when it should. I am using waiter 0.2.5.

Here is an example:

library(shiny)
library(waiter)

ui <- fluidPage(
  useWaitress(),
  actionButton("btn", "render"),
  plotOutput("plot", height = "90vh")
)

server <- function(input, output){
  
  waitress <- Waitress$new(theme = "overlay-percent", min = 0, max = 10)
  
  output$plot <- renderPlot({
    input$btn
    
    # use notification
    waitress$notify('This text should disappear')
    
    for(i in 1:5){
      waitress$inc(1) # increase by 10%
      Sys.sleep(.1)
    }
    
    hist(runif(100))
    waitress$close() # hide when done
  })
  
}

shinyApp(ui, server)

and the notification:

Captura de tela de 2022-03-02 12-29-46

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

1 participant