tbonelee commented on code in PR #5044:
URL: https://github.com/apache/zeppelin/pull/5044#discussion_r2328634645


##########
zeppelin-web-angular/src/app/pages/workspace/notebook/notebook.component.ts:
##########
@@ -142,15 +155,19 @@ export class NotebookComponent extends 
MessageListenersManager implements OnInit
       return;
     }
     const definedNote = this.note;
-    definedNote.paragraphs.splice(data.index, 0, data.paragraph).map(p => {
-      return {
-        ...p,
-        focus: p.id === data.paragraph.id
-      };
-    });
-    definedNote.paragraphs = [...definedNote.paragraphs];
+    definedNote.paragraphs.splice(data.index, 0, data.paragraph);
+    const paragraphIndex = definedNote.paragraphs.findIndex(p => p.id === 
data.paragraph.id);
+
+    definedNote.paragraphs[paragraphIndex].focus = true;
+    const addedParagraph = this.listOfNotebookParagraphComponent.find((_, 
index) => index === paragraphIndex)
+      ?.notebookParagraphCodeEditorComponent;

Review Comment:
   I think something like `this.cdr.detectChanges()` should be called, so that 
the paragraph component is added for the new paragraph in 
`definedNote.paragraph`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to