Skip to content

Commit

Permalink
fix: avoid stale data with use_task
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Feb 26, 2024
1 parent 21ea531 commit a7884ce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions solara/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,8 @@ async def square():

def wrapper(f):
task_instance = solara.use_memo(lambda: task(f, prefer_threaded=prefer_threaded), dependencies=[])
# we always update the function so we do not have stale data in the function
task_instance.function = f # type: ignore

def _prestart():
if dependencies is not None:
Expand Down

0 comments on commit a7884ce

Please sign in to comment.