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

When document layer is not ready and socket message is not delayed, m… #7073

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions browser/src/core/Socket.js
Expand Up @@ -1187,6 +1187,20 @@ app.definitions.Socket = L.Class.extend({
if (this._map._docLayer && !msgDelayed) {
this._map._docLayer._onMessage(textMsg, e.image);
}
else if (!this._map._docLayer && !msgDelayed) {
// If message is delayed and document layer is not ready at the time, message gets lost.
// To prevent this, we wait a little for document layer.
var waitForDocLayer = function(message, image) {
setTimeout(function() {
if (this._map._docLayer)
this._map._docLayer._onMessage(message, image);
else
waitForDocLayer(message, image);
}.bind(this), 300);
}.bind(this);

waitForDocLayer(textMsg, e.image);
}
},

_exportAsCallback: function(command) {
Expand Down