summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-04-14 08:13:27 +0100
committerPhil Hughes <me@iamphill.com>2017-04-14 08:13:27 +0100
commita6911d92cfe9b44eaa2b93095b8933023eb14b64 (patch)
tree6015a3b9d7ca8ea95e35e1a9b7cad219d30a3415
parent0497d3eadb67f347a6376c77cbd39511e5136bfb (diff)
downloadgitlab-ce-diff-comment-btn-debounce.tar.gz
Debounces diff comment button renderdiff-comment-btn-debounce
-rw-r--r--app/assets/javascripts/files_comment_button.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/assets/javascripts/files_comment_button.js b/app/assets/javascripts/files_comment_button.js
index 59d6508fc02..588fe960e57 100644
--- a/app/assets/javascripts/files_comment_button.js
+++ b/app/assets/javascripts/files_comment_button.js
@@ -30,7 +30,10 @@ window.FilesCommentButton = (function() {
this.render = bind(this.render, this);
this.hideButton = bind(this.hideButton, this);
this.isParallelView = notes.isParallelView();
- filesContainerElement.on('mouseover', LINE_COLUMN_CLASSES, this.render)
+
+ const debounce = _.debounce(this.render, 100);
+
+ filesContainerElement.on('mouseover', LINE_COLUMN_CLASSES, debounce)
.on('mouseleave', LINE_COLUMN_CLASSES, this.hideButton);
}