Reacton/use_thread issue
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 202
- Avg merge
- 4h 36m
- Merged PRs (30d)
- 3
Description
Running this, and hitting compute triggers a keyerror in reacton. The fix is to put str(../) around the last line, but that should not be needed.
import solara
import time
process = solara.reactive(0)
def heavy_compute():
for i in range(10):
print("Computing...", i)
process.value = i
time.sleep(0.1)
return 42
@solara.component
def Page():
compute = solara.use_reactive(False)
result_using_reactive = solara.use_reactive(None)
def maybe_do_compute():
if compute.value:
result_using_reactive.value = heavy_compute()
compute.set(False)
result = solara.use_thread(maybe_do_compute, dependencies=[compute.value])
solara.Button("Compute", on_click=lambda: compute.set(True))
solara.Button("Cancel", on_click=lambda: compute.set(False))
if result.state == solara.ResultState.RUNNING:
solara.ProgressLinear(process.value * 10)
if result_using_reactive.value:
solara.Text(result_using_reactive.value)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided Page example, especially the solara.use_thread call and its dependencies=[compute.value] argument. Inspect the use_thread path while compute triggers and capture the KeyError. Done means the example runs without wrapping the final line in str(../), while progress and result behavior remain usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100