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

Handle document delta updates sent from the server #123

Open
Tracked by #50
mofojed opened this issue Nov 20, 2023 · 4 comments · May be fixed by #1069
Open
Tracked by #50

Handle document delta updates sent from the server #123

mofojed opened this issue Nov 20, 2023 · 4 comments · May be fixed by #1069
Assignees
Milestone

Comments

@mofojed
Copy link
Member

mofojed commented Nov 20, 2023

Currently for every update, the server sends the entire re-rendered document, even if only a part of it has changed. Should only send the diff between the current document and the new document, to decrease payload size.

Note this is separate from #129 , where we only send newly exported objects.

@mofojed mofojed mentioned this issue Nov 20, 2023
89 tasks
@mofojed mofojed changed the title Handle delta updates sent from the server Handle document delta updates sent from the server Nov 21, 2023
@mofojed mofojed added this to the October 2024 milestone Oct 29, 2024
@mofojed mofojed mentioned this issue Oct 29, 2024
5 tasks
@mofojed
Copy link
Member Author

mofojed commented Nov 6, 2024

Take a look at how JSON diffs are created and applied.
Might be beneficial to look at how JSON pointers work: https://datatracker.ietf.org/doc/html/rfc6901

@mofojed
Copy link
Member Author

mofojed commented Nov 7, 2024

@wusteven815 JSON patch is the spec we should implement for processing the deltas: https://jsonpatch.com/
Looks like that page links a few JS libraries that implement it, so would want to see which one is most appropriate. Seems to only be one Python JSON patch, so hopefully it does what we need to (or we can extend).

@wusteven815
Copy link
Contributor

The fast-json-path library (https://www.npmjs.com/package/fast-json-patch) has all the features we need and has a lot of weekly downloads.

@mofojed
Copy link
Member Author

mofojed commented Nov 14, 2024

On the server side, we'll want to keep track of the previous encoded_document and get a delta with the current one. If previous doesn't exist, send documentUpdated, if it does exist, send documentDelta instead with the JSON patch:


On the client side, we'll need to add a new jsonClient method to handle the documentDelta:
And apply the patch to the previous document.

@mofojed mofojed modified the milestones: October 2024, November 2024 Nov 25, 2024
@wusteven815 wusteven815 linked a pull request Dec 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants