-
Notifications
You must be signed in to change notification settings - Fork 451
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
Adds two new doc events: 'before op batch' and 'after op batch' #247
base: master
Are you sure you want to change the base?
Conversation
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! |
We ended up publishing our fork in the interim. |
I was looking exactly for this. the |
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, |
@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 |
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 op
with theop
event, but we have found thatop
is called for each individual operation, as opposed toafter op
which 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 batch
is called before anybefore op
event in a batchafter op batch
is called after anyop
event in a batchThey currently receive no parameters, but we can change that if any parameters would be appropriate here.
Best regards!