tbonelee commented on PR #5057: URL: https://github.com/apache/zeppelin/pull/5057#issuecomment-3262446232
Thanks for digging into this with multiple approaches. Do we agree that `focus()` should run only **after** the modal is fully closed? If so, what do you think about triggering `this.messageService.paragraphRemove(this.paragraph.id)` after the modal closes? I confirmed that the return value of `nzOnOk()` is emitted to `afterClose` subject. Using that, we can run the paragraph removal (including `focus()` to the appropriate paragraph) once the modal is definitely closed. This worked in my local testing(tested version: https://github.com/tbonelee/zeppelin/commit/7a64b2eb0613543001dd05da6390f8bda7cb9322). Could you review this approace and share your thoughts? ```diff - this.nzModalService.confirm({ - nzTitle: 'Delete Paragraph', - nzContent: 'Do you want to delete this paragraph?', - nzAutofocus: null, - nzOnOk: () => { - this.messageService.paragraphRemove(this.paragraph.id); - this.cdr.markForCheck(); - } - }); + this.nzModalService + .confirm({ + nzTitle: 'Delete Paragraph', + nzContent: 'Do you want to delete this paragraph?', + nzOnOk: () => true + }) + .afterClose.pipe(takeUntil(this.destroy$)) + .subscribe(result => { + // result is undefined if a user cancels + if (result) { + this.messageService.paragraphRemove(this.paragraph.id); + this.cdr.markForCheck(); + } + }); -- 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]
