File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -152,7 +152,13 @@ async def _waiting_screen(raise_on_cancel: type[Exception] | None) -> None:
152152 ) as obj :
153153 # Block until the user confirmation.
154154 # Don't use `interact` to avoid cancelling current workflow.
155- await Layout (obj ).get_result ()
155+ layout = Layout (obj )
156+ layout .start ()
157+ # This task doesn't have access to I/O context - see `ButtonRequestHandler.join()`.
158+ # Therefore, the new layout won't start its own ButtonRequest hander,
159+ # avoiding interference with the existing layout (the one we are waiting for).
160+ assert layout .button_request_handler is None
161+ await layout .get_result ()
156162
157163 if raise_on_cancel :
158164 raise raise_on_cancel ()
@@ -212,6 +218,7 @@ async def join(self) -> None:
212218 self .box .put (None , replace = True )
213219
214220 # Wait for the ButtonRequest handler to finish (or user cancellation)
221+ # `_waiting_screen` layout won't have an I/O context, since it runs in a separate task.
215222 await loop .race (self .is_done , _waiting_screen (self .raise_on_cancel ))
216223
217224 async def _handle (self , ack_callback : AckCallback ) -> None :
You can’t perform that action at this time.
0 commit comments