WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#27390 closed enhancement (fixed)

Widget Customizer: Introduce customizer processing state

Reported by: westonruter Owned by: ocean90
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.9
Component: Widgets Keywords: has-patch
Focuses: ui, javascript Cc:

Description

When a widget is updated in the customizer, it submits the widget form via Ajax to pass the fields through the widget's update callback to validate the instance; this Ajax response supplies the value to then be set in the customizer's setting. Thus unlike other setting updates, the updating of a widget's setting is an asynchronous process and the Customizer needs to introduce a method for preventing a race condition when saving such settings which require server-side validation/processing to obtain the setting value to submit.

Originally reported on #27112:

I also saw what I believe to be an unrelated issue: if I make a change to a widget, say its title, leaving focus in the input and then immediately click "Save & Publish" the setting does not get saved, even though I can see it in the preview. If I first click out of the input (blur) and then click "Save & Publish", the setting gets updated as expected. It sticks. I'll do more investigation.

https://core.trac.wordpress.org/ticket/27112#comment:13

Attachments (1)

27390.diff (4.7 KB) - added by westonruter 8 years ago.
Introduce customizer 'processing' state. Prevent a race condition when saving settings which require server-side validation/processing to obtain the setting value to submit. Patch also pushed to GitHub: https://github.com/x-team/wordpress-develop/compare/trac-27390?w=1

Download all attachments as: .zip

Change History (5)

@westonruter
8 years ago

Introduce customizer 'processing' state. Prevent a race condition when saving settings which require server-side validation/processing to obtain the setting value to submit. Patch also pushed to GitHub: https://github.com/x-team/wordpress-develop/compare/trac-27390?w=1

#1 @westonruter
8 years ago

  • Keywords has-patch added

#2 @ocean90
8 years ago

  • Milestone changed from Awaiting Review to 3.9

#3 @westonruter
8 years ago

  • Owner set to ocean90
  • Status changed from new to reviewing

#4 @ocean90
8 years ago

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

In 27540:

Customizer: Introduce a processing state.

The processing state will prevent a save when it doesn't return 0.
Widget Customizer will use the state to prevent a save while a widget is updating, which is an asynchronous process.

props westonruter.
fixes #27390.

Note: See TracTickets for help on using tickets.