Sfoglia il codice sorgente

Only add view to `chatboxviews` after `this.model` has been set

Otherwise race-conditions arise where `this.model` is undefined
JC Brand 4 anni fa
parent
commit
548021b556
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      src/plugins/muc-views/muc.js

+ 1 - 1
src/plugins/muc-views/muc.js

@@ -19,8 +19,8 @@ export default class MUCView extends BaseChatView {
 
 
     async initialize () {
     async initialize () {
         const jid = this.getAttribute('jid');
         const jid = this.getAttribute('jid');
-        _converse.chatboxviews.add(jid, this);
         this.model = _converse.chatboxes.get(jid);
         this.model = _converse.chatboxes.get(jid);
+        _converse.chatboxviews.add(jid, this);
         this.initDebounced();
         this.initDebounced();
 
 
         this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged);
         this.listenTo(_converse, 'windowStateChanged', this.onWindowStateChanged);