feat: reactive_task decorator (re)runs a task when a dependency changes#473
Draft
maartenbreddels wants to merge 1 commit intomasterfrom
Draft
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @maartenbreddels and the rest of your teammates on |
This was referenced Jan 19, 2024
7288e79 to
86758cc
Compare
1cfa556 to
f0c7455
Compare
86758cc to
06c4657
Compare
This was referenced Feb 5, 2024
899a669 to
850c94b
Compare
1f4fc86 to
d39063b
Compare
f0c7455 to
f0b4019
Compare
f981cfd to
a9f836f
Compare
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)
```
f0b4019 to
3760636
Compare
c2951b9 to
8816e36
Compare
240a079 to
b098da1
Compare
86646f5 to
df2fd66
Compare
cded5b2 to
32af76f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Dependencies are other reactive variables.
Examples: