mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01: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:
parent
268cbd55ad
commit
b126de5c2d
@ -26,7 +26,7 @@ class UserStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSuccessFetchCurrentUser({users: [user]}) {
|
onSuccessFetchCurrentUser({users: [user = {}]}) {
|
||||||
this.userMeta.invalidateCache = false;
|
this.userMeta.invalidateCache = false;
|
||||||
this.userMeta.err = null;
|
this.userMeta.err = null;
|
||||||
this.currentUser = user;
|
this.currentUser = user;
|
||||||
|
@ -28,7 +28,7 @@ class WebhookStore {
|
|||||||
this.getInstance().lookupWebhooks();
|
this.getInstance().lookupWebhooks();
|
||||||
}
|
}
|
||||||
|
|
||||||
onSuccessFetchWebhooks({ webhooks }) {
|
onSuccessFetchWebhooks({ webhooks = [] }) {
|
||||||
this.webhookMeta.invalidateCache = false;
|
this.webhookMeta.invalidateCache = false;
|
||||||
this.webhookMeta.err = null;
|
this.webhookMeta.err = null;
|
||||||
this.webhooks = webhooks;
|
this.webhooks = webhooks;
|
||||||
|
@ -25,7 +25,7 @@ class WhitelabelStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSuccessFetchWhitelabel({ whitelabel }) {
|
onSuccessFetchWhitelabel({ whitelabel = {} }) {
|
||||||
this.whitelabelMeta.invalidateCache = false;
|
this.whitelabelMeta.invalidateCache = false;
|
||||||
this.whitelabelMeta.err = null;
|
this.whitelabelMeta.err = null;
|
||||||
this.whitelabel = whitelabel;
|
this.whitelabel = whitelabel;
|
||||||
|
Loading…
Reference in New Issue
Block a user