Răsfoiți Sursa

Wait on `chatBoxesFetched` in API

Otherwise we can run into race conditions when using IndexedDB with
mergebounce
JC Brand 4 ani în urmă
părinte
comite
4c804fcf2d
2 a modificat fișierele cu 4 adăugiri și 0 ștergeri
  1. 2 0
      src/headless/plugins/chat/api.js
  2. 2 0
      src/headless/plugins/muc/api.js

+ 2 - 0
src/headless/plugins/chat/api.js

@@ -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) {

+ 2 - 0
src/headless/plugins/muc/api.js

@@ -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);