Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes:
The
Doc
op events are currently a little confusing: ajson0
"op" canbe shattered into multiple "component ops".
In the current naming, the "op" emits a
'op batch'
event, and the"op component" emits an
'op'
event.However, calling the op an "op batch" is a little bit misleading,
because the "batch" is always an op representing a single version number
increase, and potentially considered a single conceptual change.
For example, a remote client might submit a single op:
Under the current naming scheme, this emits the following events:
'before op batch'
:[{p: ['a'], oi: 'foo'}, {p: ['b'], oi: 'bar'}]
'before op'
:[{p: ['a'], oi: 'foo'}]
'op'
:[{p: ['a'], oi: 'foo'}]
'before op'
:[{p: ['b'], oi: 'bar'}]
'op'
:[{p: ['b'], oi: 'bar'}]
'op batch'
:[{p: ['a'], oi: 'foo'}, {p: ['b'], oi: 'bar'}]
This can be considered a little surprising, and you may expect the
'op'
event to be emitted after the whole op (not its shatteredcomponents) have been applied.
Under the new naming scheme, the following events are emitted:
'beforeOp'
:[{p: ['a'], oi: 'foo'}, {p: ['b'], oi: 'bar'}]
'beforeOpComponent'
:[{p: ['a'], oi: 'foo'}]
'opComponent'
:[{p: ['a'], oi: 'foo'}]
'beforeOpComponent'
:[{p: ['b'], oi: 'bar'}]
'opComponent'
:[{p: ['b'], oi: 'bar'}]
'op'
:[{p: ['a'], oi: 'foo'}, {p: ['b'], oi: 'bar'}]
This way, you get the
'op'
event after the whole op has been applied.It also makes it more explicit that you're actively listening out for
the shattered op components where applicable.
Note that we also move the events to camelCase to be consistent with
the Backend middleware actions.