Skip to content

Commit 69ee069

Browse files
committed
removing needing to classify the function as async, instead I am looking at the function to determine
1 parent 5d492dc commit 69ee069

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

dash/_callback.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ def callback(
155155
Function to call when the callback raises an exception. Receives the
156156
exception object as first argument. The callback_context can be used
157157
to access the original callback inputs, states and output.
158-
:param use_async:
159-
Tells the system to await for this async callback.
160158
"""
161159

162160
long_spec = None
@@ -207,7 +205,6 @@ def callback(
207205
manager=manager,
208206
running=running,
209207
on_error=on_error,
210-
use_async=use_async
211208
)
212209

213210

@@ -328,7 +325,6 @@ def register_callback(
328325
manager = _kwargs.get("manager")
329326
running = _kwargs.get("running")
330327
on_error = _kwargs.get("on_error")
331-
use_async = _kwargs.get("use_async")
332328
if running is not None:
333329
if not isinstance(running[0], (list, tuple)):
334330
running = [running]
@@ -811,7 +807,7 @@ def add_context(*args, **kwargs):
811807

812808
return jsonResponse
813809

814-
if use_async:
810+
if asyncio.iscoroutinefunction(func):
815811
callback_map[callback_id]["callback"] = async_add_context
816812
else:
817813
callback_map[callback_id]["callback"] = add_context

dash/dash.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,8 +2356,7 @@ def router():
23562356
Output(_ID_CONTENT, "children"),
23572357
Output(_ID_STORE, "data"),
23582358
inputs=inputs,
2359-
prevent_initial_call=True,
2360-
use_async=True
2359+
prevent_initial_call=True
23612360
)
23622361
async def update(pathname_, search_, **states):
23632362
"""

0 commit comments

Comments
 (0)