Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#45262 closed enhancement (fixed)

Block Editor: Respect AUTOSAVE_INTERVAL value

Reported by: aduth's profile aduth Owned by: pento's profile pento
Milestone: 5.1 Priority: normal
Severity: normal Version: 5.0
Component: Editor Keywords: has-patch commit
Focuses: Cc:

Description

WordPress specifies the duration after which an autosave should occur in an editing environment via its AUTOSAVE_INTERVAL constant, defaulting to 60 seconds:

https://github.com/WordPress/wordpress-develop/blob/5d92e0c0a950399c53294a41000305ddcf47efb5/src/wp-includes/default-constants.php#L343-L345

In the development of the Gutenberg block editor, a value of 10 seconds was used instead for a more immediate save. This appears to have been persisted over to its merge into core:

https://github.com/WordPress/wordpress-develop/blob/c4bffce143d824e0dea0815fcf8adb304fd574e6/src/wp-admin/edit-form-blocks.php#L262

For compatibility's sake with the existing constant, should one of the following be considered?

  • Change the default value of AUTOSAVE_INTERVAL to 10 seconds or another value (with consideration of impact on dependants, e.g. Customize screen)
  • Assign the block editor as a factor of the AUTOSAVE_INTERVAL, e.g. AUTOSAVE_INTERVAL / 6 to keep the 10 second duration, assuming an unchanged default
  • Use the existing default 60 seconds value for the block editor.

Attachments (1)

autosave.patch (645 bytes) - added by youknowriad 7 years ago.

Download all attachments as: .zip

Change History (11)

#1 @danielbachhuber
7 years ago

  • Milestone changed from Awaiting Review to 5.0

#2 @youknowriad
7 years ago

  • Milestone changed from 5.0 to Future Release

This doesn't seem ready and also not critical.

#3 @youknowriad
7 years ago

  • Keywords has-patch added

I just went with the simplest approach for now which is to respect whatever value is set in AUTOSAVE_INTERVAL

#4 @swissspidy
7 years ago

  • Milestone changed from Future Release to 5.1

#5 @swissspidy
7 years ago

For compatibility's sake with the existing constant, should one of the following be considered?

If necessary, we could add a new filterable wp_get_autosave_interval() function, similar to wp_doing_ajax(), to make tweaking per context easier.

#6 @adamsilverstein
7 years ago

For context, my original autosave PR respected AUTOSAVE_INTERVAL, however after this discussion the interval was set back to 10: https://github.com/WordPress/gutenberg/pull/6257/commits/d795e1db8ff040dced0afc6de6baace3521246ec

#7 @adamsilverstein
7 years ago

autosave.patch looks good to me and restores the long documented and expected behavior of respecting the AUTOSAVE_INTERVAL constant.

#8 @adamsilverstein
7 years ago

  • Keywords commit added

#9 @pento
7 years ago

  • Owner set to pento
  • Status changed from new to assigned

#10 @pento
7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 44504:

Block Editor: Obey the AUTOSAVE_INTERVAL constant.

Props youknowriad.
Fixes #45262.

Note: See TracTickets for help on using tickets.