diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /app/assets/javascripts/pager.js | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/assets/javascripts/pager.js')
-rw-r--r-- | app/assets/javascripts/pager.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/app/assets/javascripts/pager.js b/app/assets/javascripts/pager.js index aa2f539b6e2..e15766a7839 100644 --- a/app/assets/javascripts/pager.js +++ b/app/assets/javascripts/pager.js @@ -22,7 +22,10 @@ export default { this.prepareData = prepareData; this.successCallback = successCallback; this.errorCallback = errorCallback; - this.loading = $(`${container} .loading`).first(); + this.$container = $(container); + this.$loading = this.$container.length + ? this.$container.find('.loading').first() + : $('.loading').first(); if (preload) { this.offset = 0; this.getOld(); @@ -31,7 +34,7 @@ export default { }, getOld() { - this.loading.show(); + this.$loading.show(); const url = $('.content_list').data('href') || removeParams(['limit', 'offset']); axios @@ -49,11 +52,11 @@ export default { if (!this.disable && !this.isScrollable()) { this.getOld(); } else { - this.loading.hide(); + this.$loading.hide(); } }) .catch((err) => this.errorCallback(err)) - .finally(() => this.loading.hide()); + .finally(() => this.$loading.hide()); }, append(count, html) { @@ -83,8 +86,12 @@ export default { fireOnce: true, ceaseFire: () => this.disable === true, callback: () => { - if (!this.loading.is(':visible')) { - this.loading.show(); + if (this.$container.length && !this.$container.is(':visible')) { + return; + } + + if (!this.$loading.is(':visible')) { + this.$loading.show(); this.getOld(); } }, |