We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 84881e7 commit 0cc8515Copy full SHA for 0cc8515
mesa/visualization/solara_viz.py
@@ -23,8 +23,8 @@
23
24
from __future__ import annotations
25
26
+import asyncio
27
import copy
-import time
28
from collections.abc import Callable
29
from typing import TYPE_CHECKING, Literal
30
@@ -235,12 +235,12 @@ def save_initial_model():
235
236
solara.use_effect(save_initial_model, [model.value])
237
238
- def step():
+ async def step():
239
while playing.value:
240
- time.sleep(play_interval / 1000)
+ await asyncio.sleep(play_interval / 1000)
241
do_step()
242
243
- solara.use_thread(step, [playing.value])
+ solara.lab.use_task(step, dependencies=[playing.value], prefer_threaded=False)
244
245
def do_step():
246
"""Advance the model by one step."""
0 commit comments