Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Conversation

@rguan72
Copy link
Collaborator

@rguan72 rguan72 commented May 23, 2019

This ended up being a pretty simple issue; only two lines of code needed to be changed.

Now instead of cumulatively returning all actions that have ever been done, getActionData (in the livewriting.js module) only returns the actions made since the last save.

So instead if the user typed ab, saved, then typed bc, the new version sends an action containing ab then bc instead of abcd (the old version).

As a side effect, the actions logged by fs.outputJSON(path.join(this.other, file, timestamp + '.json'), data) only contain actions taken since the last Cmd+S save instead of all cumulative actions.

@rguan72
Copy link
Collaborator Author

rguan72 commented May 23, 2019

The only change to the main livewriting.js module is a line inserted at 1490.

rguan72 and others added 2 commits May 26, 2019 23:48
@rguan72
Copy link
Collaborator Author

rguan72 commented May 27, 2019

Resolves #1

@rguan72 rguan72 requested a review from gabomatute May 27, 2019 18:25
@gabomatute
Copy link
Collaborator

Hey! Thanks for your work on this, seems like you are very familiar with both code bases now!

I was wondering what happens if a save fail, that is, the web page collects the changes and makes a pull request but it never reaches the server. Is it now the caller responsibility to keep track of the changes?

Also, haven't looked through the fork other changes, but this would be an API breaking change, not sure if you would ever be able to get the change merge upstream, unless you make it like an optional parameter or something.

Would it be better to keep a buffer of unsync changes in our app? Or maybe we could add a new API to do this on the livewriting code?

@rguan72
Copy link
Collaborator Author

rguan72 commented May 28, 2019

Thanks! Working on this has been fun.

The way I have it right now, it would be the caller's responsibility to keep track of changed on save fail. Not 100% sure how to change this without doing something like pass the caller's function to getActionData.

I think I'd we wanted to keep this change, we could make it happen with an optional parameter. I'm not sure whether it's better to keep a buffer of unsync changes or add a new API; I don't think a save would ever be larger than 100mb. Unless it's really slow or something, I guess we don't need the flush the buffer change

@rguan72
Copy link
Collaborator Author

rguan72 commented May 31, 2019

Definitely leaning toward not flushing the buffer knowing that no saves will exceed 100mb

@gabomatute
Copy link
Collaborator

Although it wouldn't exceed, how does performance degradation look like? Uploading a 20 Mb could take a few seconds...

@rguan72
Copy link
Collaborator Author

rguan72 commented Jun 8, 2019

@G018
Testing with about 60 lines of code, the saving delay doesn't seem to be noticeable; plus it happens asynchronously so the user can keep typing as the file saves.

Will we have to change our code if I change the API? Not 100% sure if it's worth the time

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants