summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/environments/mixins/environments_mixin.js13
-rw-r--r--changelogs/unreleased/sh-wip-fix-duplicate-env-xhr.yml5
2 files changed, 13 insertions, 5 deletions
diff --git a/app/assets/javascripts/environments/mixins/environments_mixin.js b/app/assets/javascripts/environments/mixins/environments_mixin.js
index e81a1525df0..49b36143d17 100644
--- a/app/assets/javascripts/environments/mixins/environments_mixin.js
+++ b/app/assets/javascripts/environments/mixins/environments_mixin.js
@@ -43,7 +43,11 @@ export default {
saveData(resp) {
this.isLoading = false;
- if (_.isEqual(resp.config.params, this.requestData)) {
+ // Prevent the absence of the nested flag from causing mismatches
+ const response = _.omit(resp.config.params, _.isUndefined);
+ const request = _.omit(this.requestData, _.isUndefined);
+
+ if (_.isEqual(response, request)) {
this.store.storeAvailableCount(resp.data.available_count);
this.store.storeStoppedCount(resp.data.stopped_count);
this.store.storeEnvironments(resp.data.environments);
@@ -64,10 +68,9 @@ export default {
// fetch new data
return this.service
.fetchEnvironments(this.requestData)
- .then(response => this.successCallback(response))
- .then(() => {
- // restart polling
- this.poll.restart({ data: this.requestData });
+ .then(response => {
+ this.successCallback(response);
+ this.poll.enable({ data: this.requestData, response });
})
.catch(() => {
this.errorCallback();
diff --git a/changelogs/unreleased/sh-wip-fix-duplicate-env-xhr.yml b/changelogs/unreleased/sh-wip-fix-duplicate-env-xhr.yml
new file mode 100644
index 00000000000..e7900e2230d
--- /dev/null
+++ b/changelogs/unreleased/sh-wip-fix-duplicate-env-xhr.yml
@@ -0,0 +1,5 @@
+---
+title: Fix pagination and duplicate requests in environments page
+merge_request: 25582
+author:
+type: fixed