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

feat: reactive_task decorator (re)runs a task when a dependency changes #473

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Mar 10, 2024

  1. feat: reactive_task decorator (re)runs a task when a dependency changes

    Dependencies are other reactive variables.
    
    Examples:
    
    ```
    import asyncio
    import time
    import solara
    from solara.lab import reactive_task
    
    x = solara.reactive(2)
    
    @reactive_task
    async def x_square():
        await asyncio.sleep(2)
        a = b
        return x.value**2
    
    @solara.component
    def Page():
        solara.SliderInt("x", value=x, min=0, max=10)
        if x_square.value.state == solara.ResultState.FINISHED:
            solara.Text(repr(x_square.value.value))
        solara.ProgressLinear(x_square.value.state == solara.ResultState.RUNNING)
    ```
    maartenbreddels committed Mar 10, 2024
    Configuration menu
    Copy the full SHA
    3760636 View commit details
    Browse the repository at this point in the history