mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 22:59:01 +02:00
Merge pull request #3479 from overleaf/jpa-ignore-error-of-other-doc
[frontend] do not process otUpdateError of other docs GitOrigin-RevId: 95b43fbe1f24c1b60a0b9beeb3814645231e5063
This commit is contained in:
@@ -199,7 +199,16 @@ export default (Document = (function() {
|
||||
_bindToSocketEvents() {
|
||||
this._onUpdateAppliedHandler = update => this._onUpdateApplied(update)
|
||||
this.ide.socket.on('otUpdateApplied', this._onUpdateAppliedHandler)
|
||||
this._onErrorHandler = (error, update) => this._onError(error, update)
|
||||
this._onErrorHandler = (error, message) => {
|
||||
// 'otUpdateError' are emitted per doc socket.io room, hence we can be
|
||||
// sure that message.doc_id exists.
|
||||
if (message.doc_id !== this.doc_id) {
|
||||
// This error is for another doc. Do not action it. We could open
|
||||
// a modal that has the wrong context on it.
|
||||
return
|
||||
}
|
||||
this._onError(error, message)
|
||||
}
|
||||
this.ide.socket.on('otUpdateError', this._onErrorHandler)
|
||||
this._onDisconnectHandler = error => this._onDisconnect(error)
|
||||
return this.ide.socket.on('disconnect', this._onDisconnectHandler)
|
||||
|
||||
Reference in New Issue
Block a user