on 'op' callback firing multiple times per each submitOp
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6.5k
- Forks
- 456
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 5
Description
Hi I have the following code:
shareDoc.on('op', (ops, source) => {
for (let op of ops) {
this._dispatchOperation(op);
}
});
The _dispatchOperation method gets called 4 times for each submitOp with the same ops object and source=true.
Is this by design or is it a bug?
In my case it is not what I want, therefore I modified the code as follows.
this._lastOps = null;
shareDoc.on('op', (ops, source) => {
if (lodash.isEqual(ops, this._lastOps)) return;
this._lastOps = ops;
for (let op of ops) {
this._dispatchOperation(op);
}
});
Is this ok or the three op notifications that I am ignoring may be important?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named; start by tracing the shareDoc 'op' listener and submitOp path to reproduce the four notifications and inspect why source=true is repeated. Done means establishing whether the repeated callbacks are by design or a bug, and determining whether the ignored notifications carry distinct operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100