fix: duplicate `You` on reconnect

- it might happen viewinfo message arrives before status message,
viewinfo message update view list with old _viewId because new _viewId
after reconnection is not avaialable yet
- this patch fixes this by reseting the _viewId on socket close and call
updateviewlist event after client gets new _viewId from status message

Signed-off-by: Rashesh Padia <rashesh.padia@collabora.com>
Change-Id: I88a6ade574faa1368b1635db891fe87f89fa080e
pull/8790/head
Rashesh Padia 2024-04-13 14:57:26 +01:00 committed by Rashesh Padia
parent 1aead601b3
commit 9202365fc6
3 changed files with 15 additions and 1 deletions

View File

@ -956,7 +956,7 @@ L.Control.UIManager = L.Control.extend({
},
onUpdateViews: function () {
if (!this.map._docLayer)
if (!this.map._docLayer || !this.map._docLayer._viewId)
return;
var myViewId = this.map._docLayer._viewId;

View File

@ -1452,6 +1452,11 @@ app.definitions.Socket = L.Class.extend({
this._map.fire('docloaded', {status: true});
if (this._map._docLayer) {
this._map._docLayer._onMessage(textMsg);
// call update view list viewId if it is not defined yet
if (!this._map._docLayer._getViewId())
this._map.fire('updateviewslist');
this._reconnecting = false;
// Applying delayed messages
@ -1546,6 +1551,7 @@ app.definitions.Socket = L.Class.extend({
this._map._isCursorVisible = false;
this._map._docLayer._resetCanonicalIdStatus();
this._map._docLayer._resetViewId();
}
if (isActive && this._reconnecting) {

View File

@ -1225,6 +1225,14 @@ L.CanvasTileLayer = L.Layer.extend({
this._canonicalIdInitialized = false;
},
_resetViewId: function () {
this._viewId = undefined;
},
_getViewId: function () {
return this._viewId;
},
_updateTileTwips: function () {
// smaller zoom = zoom in
var factor = Math.pow(1.2, (this._map.options.zoom - this._tileZoom));