Browse Source

add yield state in main app lifespan (#3097)

Co-authored-by: JR <romain.jouhameau@icebergdatalab.com>
RomainEconomics 1 năm trước cách đây
mục cha
commit
18ea92df92
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      nicegui/ui_run_with.py

+ 2 - 2
nicegui/ui_run_with.py

@@ -68,8 +68,8 @@ def run_with(
     @asynccontextmanager
     async def lifespan_wrapper(app):
         await _startup()
-        async with main_app_lifespan(app):
-            yield
+        async with main_app_lifespan(app) as state:
+            yield state
         await _shutdown()
 
     app.router.lifespan_context = lifespan_wrapper