Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2019-02-27 12:44:45 +0300
committerFilipa Lacerda <filipa@gitlab.com>2019-02-27 12:44:45 +0300
commitd6696f819b5b47752c6451f939d24f0f03054663 (patch)
tree3de24a3a8f5903add8ccee38f1ff42069bcac2d6 /app
parent079d471e8effe0e3b200cc7023dc81c0d155293a (diff)
parent43ac2a964ffe5f2713cb3093b4192216ec8525ad (diff)
Merge branch 'sh-wip-fix-duplicate-env-xhr' into 'master'
Fix pagination and duplicate requests in environments page Closes #58191 See merge request gitlab-org/gitlab-ce!25582
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/environments/mixins/environments_mixin.js17
1 files changed, 12 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..9d83840c87c 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 = this.filterNilValues(resp.config.params);
+ const request = this.filterNilValues(this.requestData);
+
+ if (_.isEqual(response, request)) {
this.store.storeAvailableCount(resp.data.available_count);
this.store.storeStoppedCount(resp.data.stopped_count);
this.store.storeEnvironments(resp.data.environments);
@@ -51,6 +55,10 @@ export default {
}
},
+ filterNilValues(obj) {
+ return _.omit(obj, value => _.isUndefined(value) || _.isNull(value));
+ },
+
/**
* Handles URL and query parameter changes.
* When the user uses the pagination or the tabs,
@@ -64,10 +72,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();