summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDicker Max <dicker-95@web.de>2018-08-16 15:27:56 +0000
committerFatih Acet <acetfatih@gmail.com>2018-08-16 15:27:56 +0000
commitc4d2db1f6c4fccfd1bad9b409de06fc362dc0283 (patch)
tree389da0d619947dc76a35f3fa5eb3e1ab9b38200f
parent7a0e2426bcd86e336c0bf5ff41a6ed9bb1e2cd55 (diff)
downloadgitlab-ce-c4d2db1f6c4fccfd1bad9b409de06fc362dc0283.tar.gz
Fix if-check
-rw-r--r--app/assets/javascripts/boards/components/board_list.vue2
-rw-r--r--changelogs/unreleased/41738-fix-sorting-issues-is-wrong-in-list-with-pagination.yml5
-rw-r--r--spec/javascripts/boards/board_list_spec.js9
3 files changed, 15 insertions, 1 deletions
diff --git a/app/assets/javascripts/boards/components/board_list.vue b/app/assets/javascripts/boards/components/board_list.vue
index 3e610a4088c..bfc8d9b03ad 100644
--- a/app/assets/javascripts/boards/components/board_list.vue
+++ b/app/assets/javascripts/boards/components/board_list.vue
@@ -203,7 +203,7 @@ export default {
this.showIssueForm = !this.showIssueForm;
},
onScroll() {
- if (!this.loadingMore && (this.scrollTop() > this.scrollHeight() - this.scrollOffset)) {
+ if (!this.list.loadingMore && (this.scrollTop() > this.scrollHeight() - this.scrollOffset)) {
this.loadNextPage();
}
},
diff --git a/changelogs/unreleased/41738-fix-sorting-issues-is-wrong-in-list-with-pagination.yml b/changelogs/unreleased/41738-fix-sorting-issues-is-wrong-in-list-with-pagination.yml
new file mode 100644
index 00000000000..bc0150c6586
--- /dev/null
+++ b/changelogs/unreleased/41738-fix-sorting-issues-is-wrong-in-list-with-pagination.yml
@@ -0,0 +1,5 @@
+---
+title: "Fix If-Check the result that a function was executed several times"
+merge_request: 20640
+author: Max Dicker
+type: fixed
diff --git a/spec/javascripts/boards/board_list_spec.js b/spec/javascripts/boards/board_list_spec.js
index de261d36c61..290600cf995 100644
--- a/spec/javascripts/boards/board_list_spec.js
+++ b/spec/javascripts/boards/board_list_spec.js
@@ -200,6 +200,15 @@ describe('Board list component', () => {
});
});
+ it('does not load issues if already loading', () => {
+ component.list.nextPage = spyOn(component.list, 'nextPage').and.returnValue(new Promise(() => {}));
+
+ component.onScroll();
+ component.onScroll();
+
+ expect(component.list.nextPage).toHaveBeenCalledTimes(1);
+ });
+
it('shows loading more spinner', (done) => {
component.showCount = true;
component.list.loadingMore = true;