Преглед на файлове

raise exception when ui.shutdown is called with auto-reload activated

Falko Schindler преди 2 години
родител
ревизия
8d11d747f4
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  1. 2 0
      nicegui/lifecycle.py

+ 2 - 0
nicegui/lifecycle.py

@@ -22,6 +22,8 @@ def on_shutdown(self, handler: Union[Callable, Awaitable]):
 
 
 async def shutdown(self) -> None:
+    if globals.config.reload:
+        raise Exception('ui.shutdown is not supported when auto-reload is enabled')
     for socket in [s for page in jp.WebPage.sockets.values() for s in page.values()]:
         await socket.close()
     globals.server.should_exit = True