Uh oh!
There was an error while loading. Please reload this page.
Adds two new doc events: 'before op batch' and 'after op batch' - #247
Adds two new doc events: 'before op batch' and 'after op batch'#247danburzo wants to merge 3 commits into
Conversation
coveralls
commented
Sep 13, 2018
Is there any chance we can get this merged soon? It's causing some issues for us that are hard to tackle without these events in place. Thank you! |
danburzo
commented
Oct 11, 2018
We ended up publishing our fork in the interim. |
adelriosantiago
commented
Jun 9, 2020
I was looking exactly for this. the |
alecgibson
commented
Jun 9, 2020
I'm not entirely sure I understand the motivation behind this change. What's the use case? |
When receiving a batch of events, it can be beneficial to be able to tell when the batch starts and ends, so that you may pause side-effects at the beginning of the batch, and only update and resume when you've finished incorporating all the (potentially hundreds of) individual In a previous version of sharedb, |
alecgibson
commented
Jun 9, 2020
@danburzo sounds fairly reasonable to me. I'll see if I can discuss with other contributors tomorrow. My one reservation about it is that it would be an event that only ever has relevance to the default type, but |
alecgibson
commented
Jun 10, 2020
Had a discussion with @ericyhwang . In general, this should be fine. It is a bit weird that it'll only affect the default type, but this doesn't preclude us from extending to other types later, and JSON0 already gets slightly special treatment (eg projections). Could you please:
|
We have recently upgraded from ShareJS to ShareDB following the migration guide. We've replaced
after opwith theopevent, but we have found thatopis called for each individual operation, as opposed toafter opwhich had been called after an entire batch of operations.The addition of two new events that get called at the start, and the end, of a batch of operations allows us perform the optimizations we were doing previously for when the client receives a batch of remote operations.
This pull request introduces these events:
before op batchis called before anybefore opevent in a batchafter op batchis called after anyopevent in a batchThey currently receive no parameters, but we can change that if any parameters would be appropriate here.
Best regards!