From b918a93f6854ced395e313dae0501b9267d6da30 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Wed, 28 Feb 2024 16:54:16 -0600 Subject: Fix renderSubmitResponse --- static/js/controllers/comments_controller.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/js/controllers/comments_controller.js b/static/js/controllers/comments_controller.js index d82caad..5f454df 100644 --- a/static/js/controllers/comments_controller.js +++ b/static/js/controllers/comments_controller.js @@ -43,7 +43,11 @@ export class CommentsController extends BaseController { renderSubmitResponse(response_document) { const new_comments = this.htmlFromResponse(response_document).getElementById("comment-section"); const comments = document.getElementById("comment-section"); - comments.replaceWith(new_comments); + + if(comments) + comments.replaceWith(new_comments); + else + this.comments_node.appendChild(new_comments); } async submit(event) { -- cgit v1.2.3