Skip to content
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

[API]Why are there so many APIs which have a WithPatches suffix #204

Open
lightsprint09 opened this issue Dec 23, 2024 · 1 comment
Open

Comments

@lightsprint09
Copy link
Member

Why are there so many APIs which have a WithPatches suffix. Would it for example not enough to have one merge which returns [Patche] by default. Has this some performance reasons?

Example:

@discardableResult
 public func merge(other: Document) throws -> [Patch] {
@alexjg
Copy link
Collaborator

alexjg commented Jan 7, 2025

Generating patches changes the way that automerge processes operations, for example if we're generating patches then when a key is deleted we need to figure out if the deletion of the operation in question exposes any concurrent values which were hidden by the deleted key and then we have to generate patches which represent the creation of the exposed value. The performance impact can be large enough on large document histories that I don't think we should deny the user the option to choose whether to generate patches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants