-
Notifications
You must be signed in to change notification settings - Fork 20
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
fix/170v2: add filter to delay post saving. #173
Conversation
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.
Looks close, needs a couple of changes.
wp_localize_script( | ||
'convert_to_blocks_editor', | ||
'convert_to_blocks_agent', | ||
[ | ||
'agent' => [ | ||
'next' => $this->next(), | ||
'next' => $this->next(), | ||
'save_delay' => apply_filters( 'convert_to_blocks_save_delay', 500, $post_id ) |
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.
@Sidsector9 Lets change this to 0, or there is no delay to match the legacy behaviour. For context, 500 ms adds hours to a migration that has 100k posts.
assets/js/editor/editor.js
Outdated
client.save(); | ||
setTimeout(() => { | ||
client.save(); | ||
}, config.agent.save_delay); |
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.
@Sidsector9 Lets add a JS fallback to 0 in case the BE doesn't send this var. Sometimes this happens on large migrations when the BE stalls. If save_delay
is 0, then call save directly instead of using the setTimeout
.
Description of the Change
Closes #170
How to test the Change
heading
. (Just to test if the PR works as expected to transform other elements to blocks).wp convert-to-blocks start --post_type=post
Changelog Entry
Credits
Props @mdesplenter, @Sidsector9 @dsawardekar
Checklist: