Skip to content

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

Draft
maartenbreddels wants to merge 1 commit intomasterfrom
01-19-feat_reactive_task_decorator_re_runs_a_task_when_a_dependency_changes
Draft

feat: reactive_task decorator (re)runs a task when a dependency changes#473
maartenbreddels wants to merge 1 commit intomasterfrom
01-19-feat_reactive_task_decorator_re_runs_a_task_when_a_dependency_changes

Conversation

@maartenbreddels
Copy link
Copy Markdown
Contributor

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)

Copy link
Copy Markdown
Contributor Author

maartenbreddels commented Jan 19, 2024

@maartenbreddels maartenbreddels force-pushed the 01-12-feat_task_and_use_task_for_better_asyncio_task_a_thread_execution branch from 7288e79 to 86758cc Compare January 19, 2024 19:42
@maartenbreddels maartenbreddels force-pushed the 01-19-feat_reactive_task_decorator_re_runs_a_task_when_a_dependency_changes branch from 1cfa556 to f0c7455 Compare January 19, 2024 19:42
@iisakkirotko iisakkirotko force-pushed the 01-12-feat_task_and_use_task_for_better_asyncio_task_a_thread_execution branch from 86758cc to 06c4657 Compare February 5, 2024 13:36
@iisakkirotko iisakkirotko force-pushed the 01-12-feat_task_and_use_task_for_better_asyncio_task_a_thread_execution branch 3 times, most recently from 899a669 to 850c94b Compare February 8, 2024 16:14
@maartenbreddels maartenbreddels force-pushed the 01-12-feat_task_and_use_task_for_better_asyncio_task_a_thread_execution branch 7 times, most recently from 1f4fc86 to d39063b Compare February 14, 2024 16:50
@maartenbreddels maartenbreddels force-pushed the 01-19-feat_reactive_task_decorator_re_runs_a_task_when_a_dependency_changes branch from f0c7455 to f0b4019 Compare February 14, 2024 16:50
@maartenbreddels maartenbreddels force-pushed the 01-12-feat_task_and_use_task_for_better_asyncio_task_a_thread_execution branch 8 times, most recently from f981cfd to a9f836f Compare February 16, 2024 13:34
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 maartenbreddels force-pushed the 01-19-feat_reactive_task_decorator_re_runs_a_task_when_a_dependency_changes branch from f0b4019 to 3760636 Compare March 10, 2024 21:23
@maartenbreddels maartenbreddels changed the base branch from 01-12-feat_task_and_use_task_for_better_asyncio_task_a_thread_execution to master March 10, 2024 21:23
@iisakkirotko iisakkirotko force-pushed the master branch 2 times, most recently from c2951b9 to 8816e36 Compare April 5, 2024 14:59
@maartenbreddels maartenbreddels force-pushed the master branch 2 times, most recently from 240a079 to b098da1 Compare April 8, 2024 14:47
@maartenbreddels maartenbreddels force-pushed the master branch 2 times, most recently from 86646f5 to df2fd66 Compare July 11, 2024 15:41
@maartenbreddels maartenbreddels force-pushed the master branch 2 times, most recently from cded5b2 to 32af76f Compare December 20, 2024 12:52
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

Successfully merging this pull request may close these issues.

1 participant