Short-circuit save_alert_inline_edit when in customizer #898
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a severe performance problem I encountered when the Customize Posts and JS Widgets plugin are both active. The customizer allows for modifications to many posts to be bundled in a single changeset. Also, in the customizer, the
wp_insert_post_data
filters may be manually applied in order to obtain a sanitized value for previewing. See class-wp-customize-post-setting.php. This means thewp_insert_post_data
filter could be applied many times for a given customizer preview request in order to obtain the post value for preview, and this was causing responses to slow down 5x in my tests, and even to fail entirely. The filter is applying without the value being then saved to the DB, and so no alert should be triggered.Important: In general, all Stream hooks should no-op unless the
customize_save
action was done, as this indicates that the changes are actually being persisted to the DB. Otherwise, ifis_customize_preview()
(if the customizer is active) then no logging should be done at all since it is a preview state.