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

Issue with Progress Bar Not Updating When reload = FALSE in shiny.run_app() #1763

Open
dreamtori opened this issue Nov 7, 2024 · 1 comment

Comments

@dreamtori
Copy link

dreamtori commented Nov 7, 2024

Hello,
The progress UI provided by Shiny works correctly when reload = TRUE in the shiny.run_app() function. However, when reload = FALSE, the progress bar either doesn't update properly or doesn't appear at all, and only updates once the function has finished executing.
After testing various scenarios, it seems that the reload argument is the most relevant factor. Is there a way to ensure the progress bar works correctly even when reload = FALSE?

test code

from shiny import reactive
from shiny.express import input, render, ui
import time

ui.input_action_button("button", "Compute")


@render.text
@reactive.event(input.button)
def compute():
    with ui.Progress(min=1, max=15) as p:
        p.set(message="Calculation in progress", detail="This may take a while...")

        for i in range(1, 15):
            p.set(i, message="Computing")
            time.sleep(0.1)
            # Normally use time.sleep() instead, but it doesn't yet work in Pyodide.
            # https://github.com/pyodide/pyodide/issues/2354

    return "Done computing!"
@cpsievert
Copy link
Collaborator

Hi @dreamtori, I'm having a hard time seeing/reproducing the issue you're seeing. Here is your code running on shinylive -- does the behavior there not match what you're expecting?

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

No branches or pull requests

2 participants