[wp-trac] [WordPress Trac] #49532: Clicking "preview" multiple times on a post causes an identical autosave revision to be created and destroyed repeatedly
WordPress Trac
noreply at wordpress.org
Wed Dec 29 21:24:30 UTC 2021
#49532: Clicking "preview" multiple times on a post causes an identical autosave
revision to be created and destroyed repeatedly
--------------------------+------------------------------------
Reporter: inwerpsel | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Revisions | Version: 5.4
Severity: normal | Resolution:
Keywords: has-patch | Focuses: rest-api, performance
--------------------------+------------------------------------
Comment (by adamsilverstein):
In [attachment:"49532.diff"]:
Revisions: don't create autosaves when all revisioned fields match the
post
* In the autosave controller (`wp-includes/rest-api/endpoints/class-wp-
rest-autosaves-controller.php`), adjust the existing check to see if the
autosave exactly matches the post content to run a little earlier, setting
`autosave_is_different` appropriately.
Then, when the autosave content matches the post content:
* Do not create an autosave, since that data is redundant (all revisioned
fields match)
* Persist the current behavior of removing any existing autosaves for the
current user that (again, because the data us redundant)
Prevents a cycle bug where the autosave would be added and removed with
each autosave trigger, needlessly consuming resources and potentially
exhausting post ids.
@inwerpsel if you are able, it would be great to have you confirm this
patch resolves the issue you reported.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49532#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list