dididy commented on code in PR #5057:
URL: https://github.com/apache/zeppelin/pull/5057#discussion_r2319036058
##########
zeppelin-web-angular/src/app/pages/workspace/notebook/notebook.component.ts:
##########
@@ -142,15 +149,11 @@ 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);
+
this.cdr.markForCheck();
- // TODO(hsuanxyz) focus on paragraph
+ definedNote.paragraphs[paragraphIndex].focus = true;
Review Comment:
0fd4510
No, there wasn’t a specific reason. Since it worked regardless of the order
with `markForCheck()`, I didn’t really consider it at first. However, given
Angular’s characteristics, I thought it would be more appropriate to place it
at the end, so I made the change.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]