Wait on chatBoxesFetched
in API
Otherwise we can run into race conditions when using IndexedDB with mergebounce
This commit is contained in:
parent
1f7fecab21
commit
4c804fcf2d
@ -120,6 +120,8 @@ export default {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
async get (jids, attrs={}, create=false) {
|
async get (jids, attrs={}, create=false) {
|
||||||
|
await api.waitUntil('chatBoxesFetched');
|
||||||
|
|
||||||
async function _get (jid) {
|
async function _get (jid) {
|
||||||
let model = await api.chatboxes.get(jid);
|
let model = await api.chatboxes.get(jid);
|
||||||
if (!model && create) {
|
if (!model && create) {
|
||||||
|
@ -137,6 +137,8 @@ export default {
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
async get (jids, attrs = {}, create = false) {
|
async get (jids, attrs = {}, create = false) {
|
||||||
|
await api.waitUntil('chatBoxesFetched');
|
||||||
|
|
||||||
async function _get (jid) {
|
async function _get (jid) {
|
||||||
jid = u.getJIDFromURI(jid);
|
jid = u.getJIDFromURI(jid);
|
||||||
let model = await api.chatboxes.get(jid);
|
let model = await api.chatboxes.get(jid);
|
||||||
|
Loading…
Reference in New Issue
Block a user