1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

Prevent empty change events being fired on actions that just delegate to sources

This commit is contained in:
Brett Sun 2016-01-15 13:56:56 +01:00
parent e5a8ebd623
commit f4eef6b7c8
4 changed files with 26 additions and 0 deletions

View File

@ -27,6 +27,9 @@ class EditionStore {
onFetchEdition(editionId) { onFetchEdition(editionId) {
this.getInstance().lookupEdition(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 }) { onSuccessFetchEdition({ edition }) {

View File

@ -22,6 +22,10 @@ class UserStore {
if (invalidateCache || !this.getInstance().isLoading()) { if (invalidateCache || !this.getInstance().isLoading()) {
this.getInstance().lookupCurrentUser(invalidateCache); 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 = {} ] }) { onSuccessFetchCurrentUser({ users: [ user = {} ] }) {
@ -31,6 +35,10 @@ class UserStore {
onLogoutCurrentUser() { onLogoutCurrentUser() {
this.getInstance().performLogoutCurrentUser(); this.getInstance().performLogoutCurrentUser();
// Prevent alt from sending an empty change event when a request is sent
// off to the source
this.preventDefault();
} }
onSuccessLogoutCurrentUser() { onSuccessLogoutCurrentUser() {

View File

@ -25,6 +25,10 @@ class WebhookStore {
if (invalidateCache || !this.getInstance().isLoading()) { if (invalidateCache || !this.getInstance().isLoading()) {
this.getInstance().lookupWebhooks(invalidateCache); 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 = [] }) { onSuccessFetchWebhooks({ webhooks = [] }) {
@ -38,6 +42,10 @@ class WebhookStore {
if (invalidateCache || !this.getInstance().isLoading()) { if (invalidateCache || !this.getInstance().isLoading()) {
this.getInstance().lookupWebhookEvents(invalidateCache); 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 }) { onSuccessFetchWebhookEvents({ events }) {
@ -58,6 +66,9 @@ class WebhookStore {
onRemoveWebhook(webhookId) { onRemoveWebhook(webhookId) {
this.getInstance().performRemoveWebhook(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() { onSuccessRemoveWebhook() {

View File

@ -22,6 +22,10 @@ class WhitelabelStore {
if (invalidateCache || !this.getInstance().isLoading()) { if (invalidateCache || !this.getInstance().isLoading()) {
this.getInstance().lookupWhitelabel(invalidateCache); 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 = {} }) { onSuccessFetchWhitelabel({ whitelabel = {} }) {