Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collection.chatbox is undefined in collection.chatbox #1691

Closed
laszlovl opened this issue Aug 28, 2019 · 3 comments
Closed

collection.chatbox is undefined in collection.chatbox #1691

laszlovl opened this issue Aug 28, 2019 · 3 comments
Labels

Comments

@laszlovl
Copy link
Contributor

Don't really understand what's going on, but this error is triggering frequently and it causes Converse to bork ("removing strophe handlers because of uncaught exception"). A timing issue?

diff --git a/src/headless/converse-muc.js b/src/headless/converse-muc.js
index 560db50..adcc4d7 100644
--- a/src/headless/converse-muc.js
+++ b/src/headless/converse-muc.js
@@ -279,7 +279,12 @@ converse.plugins.add('converse-muc', {
                 if (occupant.get('nick') === Strophe.getResourceFromJid(this.get('from'))) {
                     this.occupant = occupant;
                     this.occupant.on('destroy', this.onOccupantRemoved, this);
+
                     const chatbox = _.get(this, 'collection.chatbox');
+                    if (chatbox === undefined) {
+                        console.error("Could not find reference to this.collection.chatbox", this);
+                        return;
+                    }
Could not find reference to this.collection.chatbox 
Object { cid: "c235", attributes: {…}, _changing: false, _previousAttributes: {}, changed: {}, id: "62d4005f-ba93-4cf1-b90c-8521b806766e", _pending: false, occupant: {…}, vcard: {…}, _events: {…} }
converse-muc.js:285:32
    onOccupantAdded converse-muc.js:285
    Backbone 12
    updateOccupantsOnPresence converse-muc.js:1306
    onPresence converse-muc.js:1762
    presence_handler converse-muc.js:510
    run core.js:1308
    _dataRecv core.js:2549
    forEachChild core.js:306
    _dataRecv core.js:2538
    _onMessage websocket.js:499
jcbrand added a commit that referenced this issue Sep 6, 2019
so that we have automatic event deregistration when the model gets removed.
@jcbrand
Copy link
Member

jcbrand commented Sep 6, 2019

@laszlovl I think this happens when the message gets removed but that particular event handler doesn't get deregistered. I've committed a fix. Can you please remove any patches related to this that you applied and then check whether it's fixed now?

@laszlovl
Copy link
Contributor Author

Still seeing some of those, though since the error is caught now it doesn't seem to be problematic anymore.

ERROR: Could not get collection.chatbox for message: {"msgid":"blb78quohstgsanlvdo0","time":"2019-08-16T09:16:27.881Z","ephemeral":false,"chat_state":0,"is_archived":true,"is_delayed":true,"is_spoiler":false,"message":"message","references":[],"type":"groupchat","stanza_id [email protected]":"1565946987881391","from":"[email protected]/resource","nick":"Nick","sender":"them","received":"2019-09-16T10:54:10.559Z","id":"c759f12c-f6b7-472f-bc19-b346f22caa12","vcard_jid":"[email protected]"}

It looks quite reproducable in my setup, it concerns the same couple of MUC messages every time. First time logging in (with an empty localstorage) there are no errors, but if I close the Converse tab then re-open it there they are.

The affected messages do show in the MUC normally.

@jcbrand
Copy link
Member

jcbrand commented Sep 16, 2019

I also still sometimes see these errors but I haven't been able yet to drill down and find the underlying cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants