xwp / wp-core-media-widgets

Feature plugin for development of new core media widgets for image, video, and audio (and others)
https://wordpress.org/plugins/wp-core-media-widgets/
35 stars 8 forks source link

Fix race condition if hitting Save & Publish button too quickly after entering text #181

Closed westonruter closed 7 years ago

westonruter commented 7 years ago

See https://core.trac.wordpress.org/ticket/40729

obenland commented 7 years ago

I'm honestly not sure what exactly to look for here? It might also be that my local environment is to fast for me to run into that race condition?

westonruter commented 7 years ago

@obenland sorry, here is a video depicting the problem that this PR fixes: https://cloudup.com/cv94KypYpkC

Notice in the video how I move my mouse over to the Save & Publish button while keyboard focus remains in the editor. I type “3” into the editor and then immediately (within 250ms) hit Save & Publish. You'll note that the button becomes re-enabled after saving and inspecting wp.customize.dirtyValues() will show that the widget is still dirty. This is because without the change in this PR, the save operation isn't properly blocked while waiting for the update-widget request to initialize.