diff options
author | Phil Hughes <me@iamphill.com> | 2019-03-15 12:25:10 +0300 |
---|---|---|
committer | John Jarvis <jarv@gitlab.com> | 2019-03-19 20:15:53 +0300 |
commit | 26be8a1e6099a2deb041c920df0ce89d9c0ad235 (patch) | |
tree | 90d9ad268196117120c2ea2c35503baec71d60de /app | |
parent | d32f9b23bbd48e19d6e7989aafa5c75b292e1e1b (diff) |
Merge branch '56970-fix-mr-stuck-loading-on-error' into 'master'
Resolve "Merge request page loses state"
See merge request gitlab-org/gitlab-ce!25988
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/lib/utils/simple_poll.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/app/assets/javascripts/lib/utils/simple_poll.js b/app/assets/javascripts/lib/utils/simple_poll.js index 473f179ad86..576a9ec880c 100644 --- a/app/assets/javascripts/lib/utils/simple_poll.js +++ b/app/assets/javascripts/lib/utils/simple_poll.js @@ -1,10 +1,10 @@ -export default (fn, interval = 2000, timeout = 60000) => { +export default (fn, { interval = 2000, timeout = 60000 } = {}) => { const startTime = Date.now(); return new Promise((resolve, reject) => { const stop = arg => (arg instanceof Error ? reject(arg) : resolve(arg)); const next = () => { - if (Date.now() - startTime < timeout) { + if (timeout === 0 || Date.now() - startTime < timeout) { setTimeout(fn.bind(null, next, stop), interval); } else { reject(new Error('SIMPLE_POLL_TIMEOUT')); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue index 8e043ed50c9..bb76eb1030d 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue @@ -165,9 +165,12 @@ export default { }); }, initiateMergePolling() { - simplePoll((continuePolling, stopPolling) => { - this.handleMergePolling(continuePolling, stopPolling); - }); + simplePoll( + (continuePolling, stopPolling) => { + this.handleMergePolling(continuePolling, stopPolling); + }, + { timeout: 0 }, + ); }, handleMergePolling(continuePolling, stopPolling) { this.service @@ -198,6 +201,7 @@ export default { }) .catch(() => { new Flash(__('Something went wrong while merging this merge request. Please try again.')); // eslint-disable-line + stopPolling(); }); }, initiateRemoveSourceBranchPolling() { |