diff --git a/dist b/dist index 65ea4248..e58f6331 160000 --- a/dist +++ b/dist @@ -1 +1 @@ -Subproject commit 65ea42481e33ae80064e2b36cdfead764d18123c +Subproject commit e58f6331158882d15b0ac25e8b77a0e049d5d2f2 diff --git a/package.json b/package.json index 58b52f51..6d7791f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yjs", - "version": "0.8.8", + "version": "0.8.9", "description": "A framework for real-time p2p shared editing on arbitrary complex data types", "main": "./src/y.js", "scripts": { diff --git a/src/Connector.js b/src/Connector.js index 9607b536..74af6f1d 100644 --- a/src/Connector.js +++ b/src/Connector.js @@ -75,19 +75,21 @@ module.exports = function (Y/* :any */) { this.userEventListeners.push(f) } userLeft (user) { - delete this.connections[user] - if (user === this.currentSyncTarget) { - this.currentSyncTarget = null - this.findNextSyncTarget() - } - this.syncingClients = this.syncingClients.filter(function (cli) { - return cli !== user - }) - for (var f of this.userEventListeners) { - f({ - action: 'userLeft', - user: user + if (this.connections[user] != null) { + delete this.connections[user] + if (user === this.currentSyncTarget) { + this.currentSyncTarget = null + this.findNextSyncTarget() + } + this.syncingClients = this.syncingClients.filter(function (cli) { + return cli !== user }) + for (var f of this.userEventListeners) { + f({ + action: 'userLeft', + user: user + }) + } } } userJoined (user, role) {