-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Improve autosaves #4156
Improve autosaves #4156
Conversation
@youknowriad worth noting and testing with a draft post as well, eg try your testing steps above but without publishing the post. also worth checking what is created in the database before/after the changes here. I can try to add some screenshots of that once the code feels final. |
A agree - WordPress users will expect Gutenberg autosave to work as well as or better than the classic editor's autosave functionality. |
Update: Checking the db running the classic editor I realized that for draft posts the behavior should be slightly different:
|
Note: core currently core uses heartbeat for autosaves, as well as for post locking - see https://core.trac.wordpress.org/ticket/25272. I looked into using heartbeat here as well and while I think it is doable, I'm not sure how heartbeat should integrated into the app - possible via hooks. We probably need to have a broader discussion of heartbeat and whether/how it will be integrated with Gutenberg. Currently heartbeat relies on $( document ).trigger events to communicate data to/from the server. |
Heartbeat for post locking in #4217 was straightforward, going to look at adding autosaves that way as well, probably simpler than this approach. |
Autosaving via heartbeat was more straightforward than I imagined - we can leverage most of the existing code. I started on this here:https://github.com/WordPress/gutenberg/compare/feature/heartbeat-autosaving?expand=1 - still need to bring over the notification and button status bits, but we won't need the new endpoints and state tracking this way (the change check runs on the heartbeat tick) |
Closing in favor of #4218 where I have autosave and post locking working via the heartbeat api. I'll work to bring over the remaining functionality from this branch (autosave notices, etc). |
What's the status of the API endpoints introduced here? Are you expecting to pull these into #4218 as well? |
@aduth no, they are no longer needed. autosaves are transported via heartbeat and saved on the server side using core wp functionality. |
Description
New WP_REST_Autosaves_Controller handles post autosaving. WIP. Fixes #4112.
// todo:
How Has This Been Tested?
Local testing, db monitoring.
Needs more testing.
Types of changes
Checklist: