1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 08:37:59 +02:00

Add empty object defaults to stores that use sources

Avoids inconsistent state where the store might set `null` or
`undefined` due to the server’s response
This commit is contained in:
Brett Sun 2015-12-10 15:41:55 +01:00
parent 268cbd55ad
commit b126de5c2d
3 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@ class UserStore {
}
}
onSuccessFetchCurrentUser({users: [user]}) {
onSuccessFetchCurrentUser({users: [user = {}]}) {
this.userMeta.invalidateCache = false;
this.userMeta.err = null;
this.currentUser = user;

View File

@ -28,7 +28,7 @@ class WebhookStore {
this.getInstance().lookupWebhooks();
}
onSuccessFetchWebhooks({ webhooks }) {
onSuccessFetchWebhooks({ webhooks = [] }) {
this.webhookMeta.invalidateCache = false;
this.webhookMeta.err = null;
this.webhooks = webhooks;

View File

@ -25,7 +25,7 @@ class WhitelabelStore {
}
}
onSuccessFetchWhitelabel({ whitelabel }) {
onSuccessFetchWhitelabel({ whitelabel = {} }) {
this.whitelabelMeta.invalidateCache = false;
this.whitelabelMeta.err = null;
this.whitelabel = whitelabel;