Describe the bug
Every cursor movement produces an unacknowledged promise that can only fail, and each failure is logged twice: once as a 5 s timeout and once as an unhandled rejection.
SocketIOAPI.updatePosition emits clientTracking.updatePosition through the promisified emit, i.e. with an acknowledgement callback:
// src/api/socketio.ts
async updatePosition(doc_id:string, row:number, column:number) {
return this.emit('clientTracking.updatePosition', {row, column, doc_id})
.then(() => { return; });
}
Two problems with that:
- the official web frontend emits this event without an acknowledgement callback — it is a fire-and-forget notification, the server broadcasts
clientTracking.clientUpdated to the other clients and there is nothing to wait for;
- the only caller,
ClientManager (src/collaboration/clientManager.ts), does not attach a .catch, so whenever the promise rejects VS Code logs rejected promise not handled within 1 second.
While typing, this runs several times per second, so a single editing session fills the log with entries that correspond to no real failure.
Expected behavior
Moving the cursor sends the position update and nothing else: no pending promise, no timeout, no unhandled rejection.
How To Reproduce
- Open a project from overleaf.com and open a
.tex file.
- Move the cursor / type for a few seconds.
Help > Toggle Developer Tools > Console: clientTracking.updatePosition errors and rejected promise not handled within 1 second entries appear.
Environment
- Overleaf Workshop Extension version: 0.15.10
- VS Code version: 1.133.0
- Overleaf Edition: Official
Fix
Emit the event without an acknowledgement callback, as the web frontend does, keeping the current path for the Alt (HTTP) scheme where the emit is implemented as a request/response. Submitted as a pull request from fix/update-position-fire-and-forget.
Describe the bug
Every cursor movement produces an unacknowledged promise that can only fail, and each failure is logged twice: once as a 5 s timeout and once as an unhandled rejection.
SocketIOAPI.updatePositionemitsclientTracking.updatePositionthrough the promisifiedemit, i.e. with an acknowledgement callback:Two problems with that:
clientTracking.clientUpdatedto the other clients and there is nothing to wait for;ClientManager(src/collaboration/clientManager.ts), does not attach a.catch, so whenever the promise rejects VS Code logsrejected promise not handled within 1 second.While typing, this runs several times per second, so a single editing session fills the log with entries that correspond to no real failure.
Expected behavior
Moving the cursor sends the position update and nothing else: no pending promise, no timeout, no unhandled rejection.
How To Reproduce
.texfile.Help > Toggle Developer Tools > Console:clientTracking.updatePositionerrors andrejected promise not handled within 1 secondentries appear.Environment
Fix
Emit the event without an acknowledgement callback, as the web frontend does, keeping the current path for the
Alt(HTTP) scheme where the emit is implemented as a request/response. Submitted as a pull request fromfix/update-position-fire-and-forget.