-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `Doc` op events are currently a little confusing: a `json0` "op" can be 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: ```js [ {p: ['a'], oi: 'foo'}, {p: ['b'], oi: 'bar'}, ] ``` Under the **current** naming scheme, this emits the following events: 1 `'before op batch'`: `[{p: ['a'], oi: 'foo'}, {p: ['b'], oi: 'bar'}]` 2 `'before op'`: `[{p: ['a'], oi: 'foo'}]` 3 `'op'`: `[{p: ['a'], oi: 'foo'}]` 4 `'before op'`: `[{p: ['b'], oi: 'bar'}]` 5 `'op'`: `[{p: ['b'], oi: 'bar'}]` 6 `'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 shattered components) have been applied. Under the **new** naming scheme, the following events are emitted: 1 `'beforeOp'`: `[{p: ['a'], oi: 'foo'}, {p: ['b'], oi: 'bar'}]` 2 `'beforeOpComponent'`: `[{p: ['a'], oi: 'foo'}]` 3 `'opComponent'`: `[{p: ['a'], oi: 'foo'}]` 4 `'beforeOpComponent'`: `[{p: ['b'], oi: 'bar'}]` 5 `'opComponent'`: `[{p: ['b'], oi: 'bar'}]` 6 `'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.
- Loading branch information
1 parent
f2a27fc
commit df3679a
Showing
9 changed files
with
55 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.