Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Ensure post sections are added for posts that are part of a changeset #336

@westonruter

Description

@westonruter

Something like this (props @PatelUtkarsh) should be included in the plugin:

/**
 * Pre load snapshot data in customizer
 * When user saves a new snapshot and reloads customizer with that snapshot s/he should able to
 * see edited snapshot entity without searching it.
 *
 * @returns {void}
 */
component.preLoadSnapshotData = function preLoadSnapshotData() {
	api.bind( 'ready', function() {
		var settingKeys = _.keys( JSON.parse( api.previewer.query().customized ) );
		_.each( settingKeys, function( id ) {
			if ( ! /^post\[(.+?)]\[(\d+)]$/.test( id ) ) {
				return;
			}
			api.Posts.addPostSection( id );
		} );
	} );
};

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions