Remove the lazy loading of the comment delete dialog.
Simplifying the logic. This adds some nodes per comment, but not a large
amount in comparison to what's already there for a comment. On the other
hand logic is simpler and it's less special in comparison to other
dialogs that we use.
Google-Bug-Id: b/263759160
Release-Notes: skip
Change-Id: I4a9b3a8ad1ecea7eb8df87a3aeb89f11a695393b
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
index e5720b84..b4083f9 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -200,9 +200,6 @@
unresolved = true;
@property({type: Boolean})
- showConfirmDeleteModal = false;
-
- @property({type: Boolean})
unableToSave = false;
@property({type: Boolean, attribute: 'show-patchset'})
@@ -940,7 +937,6 @@
}
private renderConfirmDialog() {
- if (!this.showConfirmDeleteModal) return;
return html`
<dialog id="confirmDeleteModal" tabindex="-1">
<gr-confirm-delete-comment-dialog
@@ -1264,15 +1260,11 @@
}
}
- private async openDeleteCommentModal() {
- this.showConfirmDeleteModal = true;
- await this.updateComplete;
- await this.confirmDeleteModal?.showModal();
+ private openDeleteCommentModal() {
+ this.confirmDeleteModal?.showModal();
}
private closeDeleteCommentModal() {
- this.showConfirmDeleteModal = false;
- this.confirmDeleteModal?.remove();
this.confirmDeleteModal?.close();
}
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
index 5b191c8..6c3caed 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
@@ -127,6 +127,10 @@
</div>
</div>
</gr-endpoint-decorator>
+ <dialog id="confirmDeleteModal" tabindex="-1">
+ <gr-confirm-delete-comment-dialog id="confirmDeleteComment">
+ </gr-confirm-delete-comment-dialog>
+ </dialog>
`
);
});
@@ -166,6 +170,10 @@
</div>
</div>
</gr-endpoint-decorator>
+ <dialog id="confirmDeleteModal" tabindex="-1">
+ <gr-confirm-delete-comment-dialog id="confirmDeleteComment">
+ </gr-confirm-delete-comment-dialog>
+ </dialog>
`
);
});
@@ -238,6 +246,10 @@
</div>
</div>
</gr-endpoint-decorator>
+ <dialog id="confirmDeleteModal" tabindex="-1">
+ <gr-confirm-delete-comment-dialog id="confirmDeleteComment">
+ </gr-confirm-delete-comment-dialog>
+ </dialog>
`
);
});
@@ -336,6 +348,10 @@
</div>
</div>
</gr-endpoint-decorator>
+ <dialog id="confirmDeleteModal" tabindex="-1">
+ <gr-confirm-delete-comment-dialog id="confirmDeleteComment">
+ </gr-confirm-delete-comment-dialog>
+ </dialog>
`
);
});
@@ -421,6 +437,10 @@
</div>
</div>
</gr-endpoint-decorator>
+ <dialog id="confirmDeleteModal" tabindex="-1">
+ <gr-confirm-delete-comment-dialog id="confirmDeleteComment">
+ </gr-confirm-delete-comment-dialog>
+ </dialog>
`
);
});