Skip to content

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

@dreamtori

Description

@dreamtori

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!"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions