Make WordPress Core

Opened 4 years ago

Closed 22 months ago

#43386 closed enhancement (maybelater)

render-partials-init similar to render-partials-response in customiser selective refresh.

Reported by: gandham Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5
Component: Customize Keywords:
Focuses: ui, javascript, administration Cc:


These are the events that are triggered when a selective refresh takes place.


But there is no event to identify the start of the partial request. This is required if we want to make some changes (like display a loader) to the UI while the request in progress.

.customize-partial-refreshing class is added while the partial refresh is in progress, but a javascript event will be handy.
Use case: Partial used to update a style tag in the head.

adding the following event after initiating the request in
wp-includes/js/customize-selective-refresh.js at line 773 works, but not sure if it the right way.

self.trigger( 'render-partials-init', data );

Change History (4)

#1 @gandham
4 years ago

I think we can override the preparePlacement method and do the UI changes there, but still if we can fire an event in the prepare placement method it would be useful.

		 * Prepare container for selective refresh.
		 * @since 4.5.0
		 * @param {Placement} placement
		preparePlacement: function( placement ) {
			$( placement.container ).addClass( 'customize-partial-refreshing' );
			self.trigger( 'partial-content-initiated', placement );

#2 @westonruter
4 years ago

  • Version changed from 4.9.4 to 4.5

Yes, I think in general it is better to extend the Partial class to override the preparePlacement method in JS to achieve this.

#3 @westonruter
4 years ago

  • Component changed from General to Customize

#4 @dlh
22 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

Without any other use cases mentioned since this ticket was filed, closing as maybelater because of comment:2 and because the specific case mentioned in the description, "Partial used to update a style tag in the head," would be handled by the enhancement in #39609.

Note: See TracTickets for help on using tickets.