@@ -78,7 +78,7 @@ def __init__(
7878 self ._cached_index_html = ""
7979 self .connected = False
8080 self .backhaul_thread = backhaul_thread
81- self .dispatcher_future = None
81+ self .dispatcher_future_or_task = None
8282 if self .backhaul_thread and not _backhaul_thread .is_alive ():
8383 _backhaul_thread .start ()
8484
@@ -138,15 +138,15 @@ async def component_dispatch_app(self, scope, receive, send) -> None:
138138 await send ({"type" : "websocket.accept" })
139139 run_dispatcher = self .run_dispatcher (scope , receive , send )
140140 if self .backhaul_thread :
141- self .dispatcher_future = asyncio .run_coroutine_threadsafe (
141+ self .dispatcher_future_or_task = asyncio .run_coroutine_threadsafe (
142142 run_dispatcher , _backhaul_loop
143143 )
144144 else :
145- await run_dispatcher
145+ self . dispatcher_future_or_task = asyncio . create_task ( run_dispatcher )
146146
147147 if event ["type" ] == "websocket.disconnect" :
148- if self .dispatcher_future :
149- self .dispatcher_future .cancel ()
148+ if self .dispatcher_future_or_task :
149+ self .dispatcher_future_or_task .cancel ()
150150 break
151151
152152 if event ["type" ] == "websocket.receive" :
@@ -164,7 +164,6 @@ async def js_modules_app(self, scope, receive, send) -> None:
164164 # Make sure the user hasn't tried to escape the web modules directory
165165 try :
166166 abs_file_path = safe_join_path (
167- REACTPY_WEB_MODULES_DIR .current ,
168167 REACTPY_WEB_MODULES_DIR .current ,
169168 re .match (self .js_modules_path , scope ["path" ])[1 ],
170169 )
0 commit comments