From b6f6b3058ee21d32b52f76ed72718801c97f6e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Tue, 27 Feb 2024 11:32:18 +0100 Subject: [PATCH] updates render_in_frontend method (takes async functions into account) --- src/pydase/utils/serializer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pydase/utils/serializer.py b/src/pydase/utils/serializer.py index 5285863..f4bfa7f 100644 --- a/src/pydase/utils/serializer.py +++ b/src/pydase/utils/serializer.py @@ -56,7 +56,12 @@ def frontend(func: Callable[..., Any]) -> Callable[..., Any]: def render_in_frontend(func: Callable[..., Any]) -> bool: - """Determines if the method is decorated with the `@frontend` decorator.""" + """Determines if the method should be rendered in the frontend. + + It checks if the "@frontend" decorator was used or the method is a coroutine.""" + + if inspect.iscoroutine(func): + return True try: return func._display_in_frontend # type: ignore