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

Update Messages Alongside Hostess Progress #149

Open
jmestret opened this issue Apr 3, 2024 · 1 comment
Open

Update Messages Alongside Hostess Progress #149

jmestret opened this issue Apr 3, 2024 · 1 comment

Comments

@jmestret
Copy link

jmestret commented Apr 3, 2024

Hi!
First of all, thank you for developing such a useful package. I have a problem with using Hostess and dynamic text. I have successfully implemented dynamic messages with the spinner. However, my current approach feels somewhat inelegant, and I'm wondering if there is a cleaner alternative. The problem arises when trying to switch from the spinner to a Hostess loader while simultaneously updating messages. Is it possible to update messages while updating the Hostess progress?

I am attaching below the method I used with the spinner.

Thank you very much!

library(shiny)
library(waiter)

ui <- fluidPage(
    useWaiter(),
    actionButton("show", "Show loading with updates")
)

server <- function(input, output, session){
    # create the waiter
    waiting_screen <- tagList(
        spin_flower(),
        h4("Cool stuff loading...")
    )
    w <- Waiter$new(html = waiting_screen)
    
    msgs <- c("Loading data", "Running model", "Drawing plots")
    
    observeEvent(input$show, {
        w$show()
        
        Sys.sleep(2)
        
        for(i in 1:3){
            w$update(html = tagList(
                spin_flower(),
                h4(msgs[i])
            ))
            Sys.sleep(2)
        }
        
        w$hide()
    })
}

shinyApp(ui, server)
@JohnCoene
Copy link
Owner

Ah, I did not think of that combination. I don't really have a solution right now: I need to think of something.

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