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
Autosave: trigger autosave regardless of being idle #12839
Conversation
Plugin builds for e8e0379 are ready 🛎️!
|
Size Change: -3 B (0%) Total Size: 2.7 MB ℹ️ View Unchanged
|
@@ -58,7 +54,7 @@ function AutoSaveHandler() { | |||
); | |||
|
|||
return () => clearTimeout(timeout); | |||
}, [autoSaveInterval, hasNewChanges, isUploading, story, pages]); | |||
}, [autoSaveInterval, hasNewChanges, isUploading, isAutoSaving]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need isUploading here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we prevent saving while any upload is in progress. Always has been the case. Avoids saving data with half-finished uploads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So to confirm, if a user uploads a video and it is transcoding, there will be no autosaves? If you upload say 5 videos, that could take a while. Maybe we could add a check to see if there an process media element on them. If not do an autosave.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but IIRC only if the video is uploaded to the canvas and not just the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just asking, as if you transcoding video takes say, 5 minutes, then blocking autosaves for that time, that could be a serious problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally. We can discuss improving this in a new ticket if we can find a way to avoid saving data with half-finished uploads.
FYI there are some legit failing tests |
@miina @swissspidy - I could NOT see the autosaves triggering while doing edits under the 60 sec window. There were 60 sec regular autosaves happening, but any changes made in bewteen those 60 secs were lost when I went back to dashboard and reopened the draft story. I am checking the autosave frequency by looking for the following network call Request URL: https://stories-qa-wordpress-amp.pantheonsite.io/wp-json/web-stories/v1/web-story/21254/autosaves/?_locale=user In this screen shot the three times this was called was at exactly 60 sec intervals, even though I was making edits to the story in between. |
@miina -- could you confirm if I should be seeing more frequent network calls like this one each time I make an edit to the story? What other indicators are there to verify that autosaves are happening? Request URL: https://stories-qa-wordpress-amp.pantheonsite.io/wp-json/web-stories/v1/web-story/21254/autosaves/?_locale=user |
@kkalarickal The autosaves should be happening every 60 seconds only, not more frequently. However, they should happen while editing as well. Previously, every new edit delayed autosaving, meaning that the autosaving happened only after 60 seconds of being idle. When the user made an edit, the 60 seconds counter started again. Now, it should always fire every 60 seconds (if there are new changes). Is that not what you are seeing when testing? 🤔 |
No. I am not seeing the |
@kkalarickal The interval should not change, it's still 60 seconds (or whatever has been configured) What changed here is that you should see autosaves while making changes. Before: Autosave happens only after 60 seconds of doing nothing Now: Autosave happens every 60 seconds even if you continuously make edits |
This is all expected. As Pascal mentioned, there is no change to the 60 seconds interval. Let me know if there's still more information needed. |
Context
Summary
Removes autosave deps from
story
andpages
which resulted in autosave being triggered only when idle for the time of the interval.Relevant Technical Choices
To-do
User-facing changes
Testing Instructions
This PR can be tested by following these steps:
Reviews
Does this PR have a security-related impact?
Does this PR change what data or activity we track or use?
Does this PR have a legal-related impact?
Checklist
Type: XYZ
label to the PRFixes #12809