@@ -311,11 +311,11 @@ void ComputeThread::on_message(websocketpp::connection_hdl hdl, message_ptr msg)
311311 else
312312 cell_id.created_by_client =false ;
313313 // std::cerr << "received cell with id " << cell_id.id << std::endl;
314- if (parent_id.id == interactive_cell) {
314+ if (interactive_cells.find (parent_id.id ) != interactive_cells.end ()) {
315+ interactive_cells.insert (cell_id.id );
315316 docthread->on_interactive_output (root);
316- console_child_ids.push_back (cell_id.id );
317- }
318- else if (cell_id.id == interactive_cell || std::find (console_child_ids.begin (), console_child_ids.end (), parent_id.id ) != console_child_ids.end ()) {
317+ }
318+ else if (interactive_cells.find (cell_id.id ) != interactive_cells.end ()) {
319319 docthread->on_interactive_output (root);
320320 }
321321 else if (msg_type.find (" csl_" ) == 0 ) {
@@ -446,11 +446,11 @@ void ComputeThread::on_message(websocketpp::connection_hdl hdl, message_ptr msg)
446446 gui->process_data ();
447447 }
448448
449- void ComputeThread::execute_interactive (const std::string& code)
449+ void ComputeThread::execute_interactive (uint64_t id, const std::string& code)
450450 {
451451 assert (gui_thread_id == std::this_thread::get_id ());
452452
453- if (!connection_is_open || interactive_cell == 0 )
453+ if (!connection_is_open)
454454 return ;
455455
456456 if (code.substr (0 , 7 ) == " reset()" )
@@ -459,7 +459,7 @@ void ComputeThread::execute_interactive(const std::string& code)
459459 nlohmann::json req, header, content;
460460
461461 header[" msg_type" ] = " execute_request" ;
462- header[" cell_id" ] = interactive_cell ;
462+ header[" cell_id" ] = id ;
463463 header[" interactive" ] = true ;
464464 content[" code" ] = code.c_str ();
465465
@@ -470,11 +470,7 @@ void ComputeThread::execute_interactive(const std::string& code)
470470 std::ostringstream oss;
471471 oss << req << std::endl;
472472 wsclient.send (our_connection_hdl, oss.str (), websocketpp::frame::opcode::text);
473- }
474-
475- void ComputeThread::register_interactive_cell (uint64_t id)
476- {
477- interactive_cell = id;
473+ interactive_cells.insert (id);
478474 }
479475
480476void ComputeThread::execute_cell (DTree::iterator it)
0 commit comments