@@ -63,7 +63,7 @@ async def _clear_ydoc_outputs(self, cell_id):
6363 if not self ._file_id :
6464 return
6565
66- notebook = self .get_jupyter_ydoc (self ._file_id )
66+ notebook = await self .get_jupyter_ydoc (self ._file_id )
6767 cell_index , target_cell = notebook .find_cell (cell_id )
6868 if target_cell is not None :
6969 target_cell ["outputs" ].clear ()
@@ -117,7 +117,9 @@ async def output_task(self, msg_type, cell_id, content):
117117 if msg_type == "clear_output" :
118118 wait = content .get ("wait" , False )
119119 if not wait :
120- self .clear_cell_outputs (cell_id )
120+ clear_task = self .clear_cell_outputs (cell_id )
121+ if clear_task :
122+ await clear_task
121123 else :
122124 self ._pending_clear_output_cells [cell_id ] = True
123125
@@ -159,15 +161,10 @@ async def output_task(self, msg_type, cell_id, content):
159161 else :
160162 output = self .transform_output (msg_type , content , ydoc = True )
161163
162- # Get the notebook ydoc from the room
163- room_id = f"json:notebook:{ file_id } "
164- room = self .yroom_manager .get_room (room_id )
165- if room is None :
166- self .log .error (f"YRoom not found: { room_id } " )
164+ notebook = await self .get_jupyter_ydoc (file_id )
165+ if not notebook :
167166 return
168- notebook = await room .get_jupyter_ydoc ()
169- self .log .info (f"Notebook: { notebook } " )
170-
167+
171168 # Write the outputs to the ydoc cell.
172169 _ , target_cell = notebook .find_cell (cell_id )
173170 if target_cell is not None and output is not None :
0 commit comments