From e01f915abf814caf0aac7b0e8c018880c90bbbba Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Wed, 8 Nov 2017 20:29:45 +0100 Subject: [PATCH] Comments: Unbind event before binding Prevents flashing of comments when posting --- src/templates/nodes/custom/comment/list_embed.pug | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/templates/nodes/custom/comment/list_embed.pug b/src/templates/nodes/custom/comment/list_embed.pug index 3050240c..58da1b6a 100644 --- a/src/templates/nodes/custom/comment/list_embed.pug +++ b/src/templates/nodes/custom/comment/list_embed.pug @@ -100,8 +100,12 @@ script. }); {% if show_comments %} - $('body').on('pillar:comment-posted', function(e, comment_node_id) { + $('body') + .off('pillar:comment-posted') + .on('pillar:comment-posted', function(e, comment_node_id) { + var commentsUrl = "{{ url_for('nodes.comments_for_node', node_id=node_id) }}"; + loadComments(commentsUrl) .done(function() { $('#' + comment_node_id).scrollHere();