From f4eef6b7c81ff3348d85e33bd4ab45699765108c Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Fri, 15 Jan 2016 13:56:56 +0100 Subject: [PATCH] Prevent empty change events being fired on actions that just delegate to sources --- js/stores/edition_store.js | 3 +++ js/stores/user_store.js | 8 ++++++++ js/stores/webhook_store.js | 11 +++++++++++ js/stores/whitelabel_store.js | 4 ++++ 4 files changed, 26 insertions(+) diff --git a/js/stores/edition_store.js b/js/stores/edition_store.js index eb138fae..927c3bd5 100644 --- a/js/stores/edition_store.js +++ b/js/stores/edition_store.js @@ -27,6 +27,9 @@ class EditionStore { onFetchEdition(editionId) { this.getInstance().lookupEdition(editionId); + // Prevent alt from sending an empty change event when a request is sent + // off to the source + this.preventDefault(); } onSuccessFetchEdition({ edition }) { diff --git a/js/stores/user_store.js b/js/stores/user_store.js index 6fe6e0cf..7e0e49b0 100644 --- a/js/stores/user_store.js +++ b/js/stores/user_store.js @@ -22,6 +22,10 @@ class UserStore { if (invalidateCache || !this.getInstance().isLoading()) { this.getInstance().lookupCurrentUser(invalidateCache); } + + // Prevent alt from sending an empty change event when a request is sent + // off to the source + this.preventDefault(); } onSuccessFetchCurrentUser({ users: [ user = {} ] }) { @@ -31,6 +35,10 @@ class UserStore { onLogoutCurrentUser() { this.getInstance().performLogoutCurrentUser(); + + // Prevent alt from sending an empty change event when a request is sent + // off to the source + this.preventDefault(); } onSuccessLogoutCurrentUser() { diff --git a/js/stores/webhook_store.js b/js/stores/webhook_store.js index 70fe185b..ebc84d51 100644 --- a/js/stores/webhook_store.js +++ b/js/stores/webhook_store.js @@ -25,6 +25,10 @@ class WebhookStore { if (invalidateCache || !this.getInstance().isLoading()) { this.getInstance().lookupWebhooks(invalidateCache); } + + // Prevent alt from sending an empty change event when a request is sent + // off to the source + this.preventDefault(); } onSuccessFetchWebhooks({ webhooks = [] }) { @@ -38,6 +42,10 @@ class WebhookStore { if (invalidateCache || !this.getInstance().isLoading()) { this.getInstance().lookupWebhookEvents(invalidateCache); } + + // Prevent alt from sending an empty change event when a request is sent + // off to the source + this.preventDefault(); } onSuccessFetchWebhookEvents({ events }) { @@ -58,6 +66,9 @@ class WebhookStore { onRemoveWebhook(webhookId) { this.getInstance().performRemoveWebhook(webhookId); + // Prevent alt from sending an empty change event when a request is sent + // off to the source + this.preventDefault(); } onSuccessRemoveWebhook() { diff --git a/js/stores/whitelabel_store.js b/js/stores/whitelabel_store.js index 3f03228a..a2664ccb 100644 --- a/js/stores/whitelabel_store.js +++ b/js/stores/whitelabel_store.js @@ -22,6 +22,10 @@ class WhitelabelStore { if (invalidateCache || !this.getInstance().isLoading()) { this.getInstance().lookupWhitelabel(invalidateCache); } + + // Prevent alt from sending an empty change event when a request is sent + // off to the source + this.preventDefault(); } onSuccessFetchWhitelabel({ whitelabel = {} }) {