diff options
Diffstat (limited to 'static/js/controllers/comments_controller.js')
-rw-r--r-- | static/js/controllers/comments_controller.js | 6 |
1 files changed, 5 insertions, 1 deletions
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) { |