Wait on chatBoxesFetched in API

Otherwise we can run into race conditions when using IndexedDB with
mergebounce
This commit is contained in:
JC Brand 2021-04-28 12:05:40 +02:00
parent 1f7fecab21
commit 4c804fcf2d
2 changed files with 4 additions and 0 deletions

View File

@ -120,6 +120,8 @@ export default {
*
*/
async get (jids, attrs={}, create=false) {
await api.waitUntil('chatBoxesFetched');
async function _get (jid) {
let model = await api.chatboxes.get(jid);
if (!model && create) {

View File

@ -137,6 +137,8 @@ export default {
* });
*/
async get (jids, attrs = {}, create = false) {
await api.waitUntil('chatBoxesFetched');
async function _get (jid) {
jid = u.getJIDFromURI(jid);
let model = await api.chatboxes.get(jid);